diff --git a/Cargo.toml b/Cargo.toml index f666a48bf..601dd4140 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,19 +182,22 @@ rust.non_upper_case_globals = "allow" rust.unknown_lints = "allow" rust.unstable_name_collisions = "allow" rustdoc.private_intra_doc_links = "allow" -clippy.len_without_is_empty = "allow" # we're not a library crate -clippy.let_and_return = "allow" -clippy.manual_range_contains = "allow" -clippy.map_unwrap_or = "warn" -clippy.needless_lifetimes = "allow" -clippy.new_without_default = "allow" -clippy.option_map_unit_fn = "allow" + +[workspace.lints.clippy] +cloned_instead_of_copied = "warn" +len_without_is_empty = "allow" # we're not a library crate +let_and_return = "allow" +manual_range_contains = "allow" +map_unwrap_or = "warn" +needless_lifetimes = "allow" +new_without_default = "allow" +option_map_unit_fn = "allow" # We do not want to use the e?print(ln)?! macros. # These lints flag their use. # In the future, they might change to flag other methods of printing. -clippy.print_stdout = "deny" -clippy.print_stderr = "deny" +print_stdout = "deny" +print_stderr = "deny" [lints] workspace = true diff --git a/src/builtins/fish_indent.rs b/src/builtins/fish_indent.rs index 9a1016a4b..2cfe6f8b4 100644 --- a/src/builtins/fish_indent.rs +++ b/src/builtins/fish_indent.rs @@ -1255,7 +1255,7 @@ struct TokenRange { } let mut token_ranges: Vec = vec![]; - for (i, color) in colors.iter().cloned().enumerate() { + for (i, color) in colors.iter().copied().enumerate() { let role = color.foreground; // See if we can extend the last range. if let Some(last) = token_ranges.last_mut() { diff --git a/src/env/environment_impl.rs b/src/env/environment_impl.rs index 336f129b5..fedc46f85 100644 --- a/src/env/environment_impl.rs +++ b/src/env/environment_impl.rs @@ -595,7 +595,7 @@ fn export_array_needs_regeneration(&self) -> bool { let mut cursor = self.export_array_generations.iter().fuse(); let mut mismatch = false; self.enumerate_generations(|r#gen| { - if cursor.next().cloned() != Some(r#gen) { + if cursor.next().copied() != Some(r#gen) { mismatch = true; } }); diff --git a/src/input.rs b/src/input.rs index 589239618..a48396414 100644 --- a/src/input.rs +++ b/src/input.rs @@ -509,7 +509,7 @@ fn next_is_char( return self.next_is_char(style, Key::from_raw(key.codepoint), true); } else if actual_seq .get(self.subidx + 1) - .cloned() + .copied() .map(|c| Key::from_single_char(c).codepoint) == Some(key.codepoint) { diff --git a/src/pager.rs b/src/pager.rs index c6ba73b29..b4a5a2910 100644 --- a/src/pager.rs +++ b/src/pager.rs @@ -434,7 +434,7 @@ fn completion_print( let effective_selected_idx = self.visual_selected_completion_index(rows, cols); for row in row_start..row_stop { - for (col, col_width) in width_by_column.iter().cloned().enumerate() { + for (col, col_width) in width_by_column.iter().copied().enumerate() { let idx = col * rows + row; if lst.len() <= idx { continue;