mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 16:51:15 -03:00
clippy: fix cloned_instead_of_copied lint
https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied Closes #12244
This commit is contained in:
committed by
Johannes Altmanninger
parent
c915435417
commit
41b9584bb3
21
Cargo.toml
21
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
|
||||
|
||||
@@ -1255,7 +1255,7 @@ struct TokenRange {
|
||||
}
|
||||
|
||||
let mut token_ranges: Vec<TokenRange> = 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() {
|
||||
|
||||
2
src/env/environment_impl.rs
vendored
2
src/env/environment_impl.rs
vendored
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user