Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion purl/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ mod tests {
impl PurlShape for MyBadPackageType {
type Error = ParseError;

fn package_type(&self) -> Cow<str> {
fn package_type(&self) -> Cow<'_, str> {
Cow::Borrowed("!")
}

Expand Down
11 changes: 6 additions & 5 deletions purl/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, doc(auto_cfg))]

use std::borrow::Cow;

Expand Down Expand Up @@ -117,7 +118,7 @@ pub trait PurlShape {
/// The returned value should be a lower case string. If the returned value
/// contains invalid characters, `Display` and `to_string` will panic.
#[must_use]
fn package_type(&self) -> Cow<str>;
fn package_type(&self) -> Cow<'_, str>;

/// Preview and potentially modify the parts that make up a PURL.
///
Expand All @@ -136,7 +137,7 @@ pub trait PurlShape {
impl PurlShape for String {
type Error = ParseError;

fn package_type(&self) -> Cow<str> {
fn package_type(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}

Expand All @@ -155,7 +156,7 @@ impl PurlShape for String {
impl PurlShape for Cow<'_, str> {
type Error = ParseError;

fn package_type(&self) -> Cow<str> {
fn package_type(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}

Expand Down Expand Up @@ -188,7 +189,7 @@ where
{
type Error = ParseError;

fn package_type(&self) -> Cow<str> {
fn package_type(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}

Expand Down
2 changes: 1 addition & 1 deletion purl/src/package_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl From<UnsupportedPackageType> for PackageError {
impl PurlShape for PackageType {
type Error = PackageError;

fn package_type(&self) -> Cow<str> {
fn package_type(&self) -> Cow<'_, str> {
self.name().into()
}

Expand Down
2 changes: 1 addition & 1 deletion purl/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ fn decode_namespace(namespace: &str) -> Result<SmallString, ParseError> {
Ok(rebuilt)
}

fn decode(input: &str) -> Result<Cow<str>, ParseError> {
fn decode(input: &str) -> Result<Cow<'_, str>, ParseError> {
percent_decode_str(input).decode_utf8().map_err(|_| ParseError::InvalidEscape)
}

Expand Down
6 changes: 3 additions & 3 deletions purl/src/qualifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ impl Qualifiers {
}

/// Iterate over the elements of the list.
pub fn iter(&self) -> Iter {
pub fn iter(&self) -> Iter<'_> {
Iter(self.qualifiers.iter())
}

/// Iterate over the elements of the list.
///
/// Only the value may be mutated.
pub fn iter_mut(&mut self) -> IterMut {
pub fn iter_mut(&mut self) -> IterMut<'_> {
IterMut(self.qualifiers.iter_mut())
}

Expand Down Expand Up @@ -159,7 +159,7 @@ impl Qualifiers {
/// This allows obtaining the current value and modifying it or inserting a
/// new value without needing to search for the qualifier multiple
/// times.
pub fn entry<K>(&mut self, key: K) -> Result<Entry<K>, ParseError>
pub fn entry<K>(&mut self, key: K) -> Result<Entry<'_, K>, ParseError>
where
K: AsRef<str>,
{
Expand Down
2 changes: 1 addition & 1 deletion purl/src/qualifiers/well_known.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl Checksum<'_> {
/// Iterate over the hashes.
///
/// Hashes are returned in no particular order.
pub fn iter(&self) -> ChecksumIter {
pub fn iter(&self) -> ChecksumIter<'_> {
ChecksumIter(self.algorithms.iter())
}
}
Expand Down
1 change: 1 addition & 0 deletions purl_test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This file is autogenerated by generate_tests.rs.
// Use `cargo xtask codegen` to regenerate it.
#![cfg(test)]
#![allow(clippy::needless_question_mark)]

use std::str::FromStr;

Expand Down
2 changes: 2 additions & 0 deletions xtask/src/generate_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ pub fn main() {
writeln!(file, "// This file is autogenerated by generate_tests.rs.").unwrap();
writeln!(file, "// Use `cargo xtask codegen` to regenerate it.").unwrap();
writeln!(file, "#![cfg(test)]").unwrap();
// Sometimes it is needed and sometimes it isn't.
writeln!(file, "#![allow(clippy::needless_question_mark)]").unwrap();
writeln!(file).unwrap();
writeln!(file, "{}", prettyplease::unparse(&suite)).unwrap();
}
Expand Down
Loading