From 1cbd18cc304a2e8e16bbec0fe7029f353fb48489 Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Sat, 29 Jun 2024 18:53:24 -0700 Subject: [PATCH] Tweak the allowed clippy set and fix some --- src/builtins/jobs.rs | 6 +++--- src/builtins/read.rs | 2 +- src/builtins/string/shorten.rs | 2 +- src/lib.rs | 5 +---- src/tests/history.rs | 6 +++--- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/builtins/jobs.rs b/src/builtins/jobs.rs index 5a817b82b..5b633c401 100644 --- a/src/builtins/jobs.rs +++ b/src/builtins/jobs.rs @@ -96,7 +96,7 @@ fn builtin_jobs_print(j: &Job, mode: JobsPrintMode, header: bool, streams: &mut JobsPrintMode::PrintGroup => { if header { // Print table header before first job. - out += &wgettext!("Group\n")[..]; + out += wgettext!("Group\n"); } out += &sprintf!("%d\n", pgid)[..]; streams.out.append(out); @@ -104,7 +104,7 @@ fn builtin_jobs_print(j: &Job, mode: JobsPrintMode, header: bool, streams: &mut JobsPrintMode::PrintPid => { if header { // Print table header before first job. - out += &wgettext!("Process\n")[..]; + out += wgettext!("Process\n"); } for p in j.processes() { @@ -115,7 +115,7 @@ fn builtin_jobs_print(j: &Job, mode: JobsPrintMode, header: bool, streams: &mut JobsPrintMode::PrintCommand => { if header { // Print table header before first job. - out += &wgettext!("Command\n")[..]; + out += wgettext!("Command\n"); } for p in j.processes() { diff --git a/src/builtins/read.rs b/src/builtins/read.rs index c91ba3633..a65b70e8c 100644 --- a/src/builtins/read.rs +++ b/src/builtins/read.rs @@ -539,7 +539,7 @@ pub fn read(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Opt Err(retval) => return retval, }; let cmd = argv[0]; - let mut argv = &argv[..]; + let mut argv: &[&wstr] = argv; if !opts.to_stdout { argv = &argv[optind..]; } diff --git a/src/builtins/string/shorten.rs b/src/builtins/string/shorten.rs index ce84e8afe..7455da3a6 100644 --- a/src/builtins/string/shorten.rs +++ b/src/builtins/string/shorten.rs @@ -124,7 +124,7 @@ impl<'args> StringSubCommand<'args> for Shorten<'args> { // truncating instead. (L!(""), 0) } else { - (&self.ellipsis[..], self.ellipsis_width) + (self.ellipsis, self.ellipsis_width) }; let mut nsub = 0usize; diff --git a/src/lib.rs b/src/lib.rs index 8754e76d8..c3eb7819e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,21 +5,18 @@ #![allow(unstable_name_collisions)] #![allow(clippy::assigning_clones)] #![allow(clippy::bool_assert_comparison)] -#![allow(clippy::box_default)] #![allow(clippy::collapsible_if)] #![allow(clippy::comparison_chain)] #![allow(clippy::derivable_impls)] +#![allow(clippy::doc_lazy_continuation)] #![allow(clippy::field_reassign_with_default)] #![allow(clippy::get_first)] #![allow(clippy::if_same_then_else)] #![allow(clippy::incompatible_msrv)] #![allow(clippy::len_without_is_empty)] #![allow(clippy::manual_is_ascii_check)] -#![allow(clippy::mut_from_ref)] -#![allow(clippy::needless_return)] #![allow(clippy::new_without_default)] #![allow(clippy::option_map_unit_fn)] -#![allow(clippy::redundant_slicing)] #![allow(clippy::too_many_arguments)] #![allow(clippy::uninlined_format_args)] diff --git a/src/tests/history.rs b/src/tests/history.rs index 7169239d6..503fd990e 100644 --- a/src/tests/history.rs +++ b/src/tests/history.rs @@ -463,7 +463,7 @@ fn test_history_path_detection() { // Place one valid file in the directory. let filename = L!("testfile"); - std::fs::write(wcs2osstring(&(tmpdir.clone() + &filename[..])), []).unwrap(); + std::fs::write(wcs2osstring(&(tmpdir.clone() + filename)), []).unwrap(); let test_vars = EnvStack::new(); test_vars.set_one(L!("PWD"), EnvMode::GLOBAL, tmpdir.clone()); @@ -560,8 +560,8 @@ fn install_sample_history(name: &wstr) { std::fs::copy( env!("CARGO_MANIFEST_DIR").to_owned() + "/tests/" - + std::str::from_utf8(&wcs2string(&name[..])).unwrap(), - wcs2osstring(&(path + L!("/") + &name[..] + L!("_history"))), + + std::str::from_utf8(&wcs2string(name)).unwrap(), + wcs2osstring(&(path + L!("/") + name + L!("_history"))), ) .unwrap(); }