Skip to content

Commit

Permalink
fixing clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunicorn committed Nov 5, 2021
1 parent 446c518 commit 5bf0f06
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ fn make_pkg_predicate(
.into(),
);
}
Some(util::changed_packages(ws, &changed_since)?)
Some(util::changed_packages(ws, changed_since)?)
} else {
None
};
Expand Down Expand Up @@ -537,7 +537,7 @@ pub fn run(args: Opt) -> Result<(), Box<dyn Error>> {
let predicate = make_pkg_predicate(&ws, pkg_opts)?;

for pkg in ws.members().filter(|p| predicate(p)) {
commands::add_owner(ws.config(), &pkg, owner.clone(), t.clone())?;
commands::add_owner(ws.config(), pkg, owner.clone(), t.clone())?;
}
Ok(())
}
Expand Down Expand Up @@ -617,13 +617,13 @@ pub fn run(args: Opt) -> Result<(), Box<dyn Error>> {
let mut items = v
.pre
.as_str()
.split(".")
.split('.')
.map(|s| s.to_string())
.collect::<Vec<_>>();
if let Some(num) = items.last().and_then(|u| u.parse::<u32>().ok())
{
let _ = items.pop();
items.push(format!("{}", num + 1).to_owned());
items.push(format!("{}", num + 1));
} else {
items.push("1".to_owned());
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn check_metadata(metadata: &ManifestMetadata) -> Result<(), String> {
_ => {}
}
match (metadata.license.as_ref(), metadata.license_file.as_ref()) {
(Some(ref s), None) | (None, Some(ref s)) if !s.is_empty() => {}
(Some(s), None) | (None, Some(s)) if !s.is_empty() => {}
(Some(_), Some(_)) => bad_fields.push("You can't have license AND license_file"),
_ => bad_fields.push("Neither license nor license_file is provided"),
}
Expand Down Expand Up @@ -255,7 +255,7 @@ pub fn check<'a>(
if check_readme {
c.shell().status("Checking", "Readme files")?;
let errors = packages.iter().fold(Vec::new(), |mut res, pkg| {
if let Err(e) = self::check_readme(&ws, &pkg) {
if let Err(e) = self::check_readme(ws, pkg) {
res.push(format!(
"{:}: Checking Readme file failed with: {:}",
pkg.name(),
Expand Down Expand Up @@ -331,7 +331,7 @@ pub fn check<'a>(
.current()
.expect("We've build localised workspaces. qed"),
)?;
let ws = run_check(&pkg_ws, &rw_lock, &opts, build_mode, &replaces)?;
let ws = run_check(pkg_ws, rw_lock, &opts, build_mode, &replaces)?;
let new_pkg = ws.current().expect("Each workspace is for a package!");
replaces.insert(
new_pkg.name().as_str().to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn release(
c.shell().status("Publishing", &pkg)?;
publish(&pkg_ws, &opts)?;
if let Some(ref o) = owner {
add_owner(c, &pkg, o.clone(), token.clone())?;
add_owner(c, pkg, o.clone(), token.clone())?;
}
}
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/commands/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where
let c = ws.config();

let updates = edit_each(
members_deep(&ws).iter().filter(|p| predicate(p)),
members_deep(ws).iter().filter(|p| predicate(p)),
|p, doc| {
Ok(mapper(p).map(|new_name| {
c.shell()
Expand All @@ -73,7 +73,7 @@ where
}

c.shell().status("Updating", "Dependency tree")?;
edit_each(members_deep(&ws).iter(), |p, doc| {
edit_each(members_deep(ws).iter(), |p, doc| {
c.shell().status("Updating", p.name())?;
let root = doc.as_table_mut();
let mut updates_count = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/to_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ where
let mut graph = Graph::<Package, (), _, _>::new();
let members = members_deep(ws);

let (members, to_ignore): (Vec<_>, Vec<_>) = members.iter().partition(|m| predicate(&m));
let (members, to_ignore): (Vec<_>, Vec<_>) = members.iter().partition(|m| predicate(m));

let ignored = to_ignore
.into_iter()
Expand Down Expand Up @@ -106,7 +106,7 @@ where
let indices = petgraph::algo::toposort(&graph, None).map_err(|c| {
format!(
"Cycle detected: {:}",
graph.node_weight(c.node_id()).unwrap().name().to_string()
graph.node_weight(c.node_id()).unwrap().name()
)
})?;
let packages = indices
Expand Down

0 comments on commit 5bf0f06

Please sign in to comment.