diff --git a/src/format/mod.rs b/src/format/mod.rs index e8841d8..e98c058 100644 --- a/src/format/mod.rs +++ b/src/format/mod.rs @@ -25,7 +25,7 @@ impl Pattern { RawChunk::Argument("l") => Chunk::License, RawChunk::Argument("r") => Chunk::Repository, RawChunk::Argument(ref a) => { - return Err(anyhow!("unsupported pattern `{}`", a).into()); + return Err(anyhow!("unsupported pattern `{}`", a)); } RawChunk::Error(err) => return Err(anyhow!("{}", err)), }; diff --git a/src/format/parse.rs b/src/format/parse.rs index 5aa115c..15f875c 100644 --- a/src/format/parse.rs +++ b/src/format/parse.rs @@ -15,7 +15,7 @@ pub struct Parser<'a> { impl<'a> Parser<'a> { pub fn new(s: &'a str) -> Parser<'a> { Parser { - s: s, + s, it: s.char_indices().peekable(), } } diff --git a/src/tree.rs b/src/tree.rs index f5d334f..f99ad17 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -83,7 +83,7 @@ pub fn print(args: &Args, graph: &Graph) -> Result<(), Error> { } fn find_package<'a>(package: &str, graph: &'a Graph) -> Result<&'a PackageId, Error> { - let mut it = package.split(":"); + let mut it = package.split(':'); let name = it.next().unwrap(); let version = it .next() @@ -107,7 +107,7 @@ fn find_package<'a>(package: &str, graph: &'a Graph) -> Result<&'a PackageId, Er candidates.push(package); } - if candidates.len() == 0 { + if candidates.is_empty() { Err(anyhow!("no crates found for package `{}`", package)) } else if candidates.len() > 1 { let specs = candidates