Skip to content

Commit

Permalink
Warn against implicit_clone again
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Mar 4, 2024
1 parent 834e5fd commit 4d53c30
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ rest_pat_in_fully_bound_structs = "warn" # Prefer not to use `..` in fully bound
verbose_file_reads = "warn" # Prefer simpler and more concise `fs::read_to_string`
# # Pedantic
pedantic = "warn" # Warn about pedantic lints, except...
implicit_clone = { level = "allow", priority = 1 } # A lot of false positives, tuned down in Clippy bundled with Rust 1.73
match_same_arms = { level = "allow", priority = 1 } # It's often clearer to have the same arm twice
missing_errors_doc = { level = "allow", priority = 1 } # Most of our code is internal; let's not clutter the docs until...
missing_panics_doc = { level = "allow", priority = 1 } # ... we care about the public documentation in our shipped crates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn collect_top_level_items(analysis: &mut Analysis) {
}

analysis.metadata.insert(
(**name).to_owned(),
(**name).clone(),
ItemMetadata {
name: name.clone(),
item: item.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ fn check_reference(
if let Some(source) = source {
analysis.metadata[source]
.referenced_items
.push((**reference).to_owned());
.push((**reference).clone());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ impl VersionSet {
// there is some overlap:
// make sure 'range' is included in 'from..till', then remove it:
if range.start < from {
from = range.start.to_owned();
from = range.start.clone();
}
if till < range.end {
till = range.end.to_owned();
till = range.end.clone();
}
false
});
Expand Down Expand Up @@ -89,7 +89,7 @@ impl VersionSet {

if first.start < second.start {
// take part of first that exists before second:
ranges.push(first.start.to_owned()..second.start.to_owned());
ranges.push(first.start.clone()..second.start.clone());
}

if first.end <= second.end {
Expand All @@ -99,7 +99,7 @@ impl VersionSet {
}

// keep part of first that exists after second:
first.start = second.end.to_owned();
first.start = second.end.clone();

// advance second, as it's been fully processed:
second_iter.next();
Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/language/internal_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::input_model::InputItem;
pub fn derive_spanned_type(args: TokenStream, mut input: TokenStream) -> TokenStream {
let spanned_type = {
let spanned_derive_args = args.into();
let input = input.to_owned();
let input = input.clone();

let item = syn::parse_macro_input!(input as InputItem);
derive::spanned(item, spanned_derive_args)
Expand Down
4 changes: 2 additions & 2 deletions crates/infra/utils/src/cargo/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl CargoWorkspace {
.get(crate_name)
.with_context(|| format!("Cannot find dependency '{crate_name}' in workspace."))?
.version
.to_owned()
.clone()
.with_context(|| {
format!("Dependency '{crate_name}' did not specify a version in Cargo.toml.")
})?
Expand All @@ -47,7 +47,7 @@ impl CargoWorkspace {
.get(crate_name)
.with_context(|| format!("Cannot find dependency '{crate_name}' in workspace."))?
.path
.to_owned()
.clone()
.with_context(|| {
format!("Dependency '{crate_name}' did not specify a path in Cargo.toml.")
})?;
Expand Down
2 changes: 1 addition & 1 deletion crates/infra/utils/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl Display for Command {
parts.push("&&".to_owned());
}

parts.push(self.name.to_owned());
parts.push(self.name.clone());

for arg in &self.args {
let delimiter = if arg.contains(' ') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl KeywordVersioningCommand {

for variation in variations {
assert!(
already_seen.insert((&item.identifier, variation.to_owned())),
already_seen.insert((&item.identifier, variation.clone())),
"Duplicate variation: {variation}"
);

Expand Down

0 comments on commit 4d53c30

Please sign in to comment.