Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ rustflags = [
"-Wclippy::map_err_ignore",
"-Wclippy::map_flatten",
"-Wclippy::map_unwrap_or",
"-Wclippy::match_on_vec_items",
"-Wclippy::match_same_arms",
"-Wclippy::match_wild_err_arm",
"-Wclippy::match_wildcard_for_single_variants",
Expand Down
51 changes: 44 additions & 7 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ serde = "1.0.219"
serde_json = { version = "1.0.141", optional = true }
serde_yaml_ng = "0.10.0"
tempfile = { version = "3.20.0", optional = true }
toml_edit = "0.22.27"
toml_edit = "0.23.2"
tracing = { version = "0.1.41", optional = true }

[dev-dependencies]
glob = "0.3.2"
lazy_static = "1.5.0"
pretty_assertions = "1.4.1"
rand = "0.9.1"
rand = "0.9.2"
rstest = "0.25.0"
serde = "1.0.219"
zepter = { path = ".", features = ["testing"] }
Expand Down
26 changes: 10 additions & 16 deletions src/autofix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ impl AutoFixer {
let last_str = last.as_str().unwrap();
if cur_str < last_str {
return Err(format!(
"Cannot de-duplicate: feature is not sorted: {} < {}",
cur_str, last_str
"Cannot de-duplicate: feature is not sorted: {cur_str} < {last_str}"
))
}

Expand Down Expand Up @@ -214,7 +213,7 @@ impl AutoFixer {

prefix = Self::format_pre_and_suffix(prefix);
prefix = prefix.trim().into();
prefix = if prefix.is_empty() { "\n\t".into() } else { format!("\n\t{}\n\t", prefix) };
prefix = if prefix.is_empty() { "\n\t".into() } else { format!("\n\t{prefix}\n\t") };
value.decor_mut().set_suffix(suffix);
value.decor_mut().set_prefix(prefix);
}
Expand All @@ -228,7 +227,7 @@ impl AutoFixer {

suffix = Self::format_pre_and_suffix(suffix);
suffix = suffix.trim().into();
suffix = if suffix.is_empty() { ",\n".into() } else { format!(",\n\t{}\n", suffix) };
suffix = if suffix.is_empty() { ",\n".into() } else { format!(",\n\t{suffix}\n") };
value.decor_mut().set_suffix(suffix);
}

Expand Down Expand Up @@ -600,8 +599,7 @@ impl AutoFixer {
}
} else {
return Err(format!(
"Dependency '{}' already exists in the workspace, but an existing alias in one of the packages has the same name as an un-aliased workspace dependency. This would silently use a different package than expected.",
dep_name
"Dependency '{dep_name}' already exists in the workspace, but an existing alias in one of the packages has the same name as an un-aliased workspace dependency. This would silently use a different package than expected."
))
}
}
Expand Down Expand Up @@ -652,7 +650,7 @@ impl AutoFixer {
// - There is either no default-features or its compatible
t = found.clone();
} else {
return Err(format!("Dependency '{}' already exists in the workspace but could not validate its compatibility", dep_name))
return Err(format!("Dependency '{dep_name}' already exists in the workspace but could not validate its compatibility"))
}
}

Expand All @@ -666,14 +664,10 @@ impl AutoFixer {
t.insert("default-features", Value::Boolean(Formatted::new(default_feats)));
}

let name = if maybe_rename.is_some() {
log::info!(
"Renaming workspace dependency '{}' to '{}'",
dep_name,
maybe_rename.unwrap()
);
let name = if let Some(rename) = maybe_rename {
log::info!("Renaming workspace dependency '{dep_name}' to '{rename}'");
t.insert("package", Value::String(Formatted::new(dep_name.to_string())));
maybe_rename.unwrap()
rename
} else {
dep_name
};
Expand Down Expand Up @@ -724,14 +718,14 @@ impl AutoFixer {

let deps = doc["dependencies"].as_table_mut().unwrap();
let Some(dep) = deps.get_mut(dep) else {
return Err(format!("Dependency '{}' not found", dep))
return Err(format!("Dependency '{dep}' not found"))
};

if let Some(dep) = dep.as_inline_table_mut() {
dep.insert("default-features", Value::Boolean(Formatted::new(false)));
Ok(())
} else {
Err(format!("Dependency '{}' is not an inline table", dep))
Err(format!("Dependency '{dep}' is not an inline table"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl DebugCmd {

if !self.no_benchmark {
let (took, points) = Self::measure(&meta);
println!("DAG setup time: {:.2?} (avg from {} runs)", took, points);
println!("DAG setup time: {took:.2?} (avg from {points} runs)");
}
}

Expand All @@ -52,7 +52,7 @@ impl DebugCmd {
histogram.add(dag.degree(node) as u64);
}

println!("{}", histogram);
println!("{histogram}");
}

fn measure(meta: &Metadata) -> (Duration, u32) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl FormatFeaturesCmd {
for (path, pkg, fixer) in offenders.iter_mut() {
// trim of the allowed_dir, if possible:
let psuffix =
self.print_paths.then(|| format!(" {}", path.display())).unwrap_or_default();
if self.print_paths { format!(" {}", path.display()) } else { Default::default() };
println!(" {}{}", global.bold(pkg), psuffix);

if !self.fix {
Expand Down
Loading