From 4bae1f3de9cf71f9d6174bbc3094b5b1f33a71ba Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 12 Jan 2024 14:07:54 +0100 Subject: [PATCH] Address clippy lints on stable Rust --- Cargo.toml | 2 ++ fish-rust/src/lib.rs | 2 ++ fish-rust/src/parse_tree.rs | 8 -------- fish-rust/src/threads.rs | 2 +- fish-rust/src/wutil/dir_iter.rs | 1 + 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5532a8e5..af5c696cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,9 +87,11 @@ clippy.derivable_impls = "allow" clippy.field_reassign_with_default = "allow" clippy.get_first = "allow" clippy.if_same_then_else = "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.ptr_arg = "allow" clippy.redundant_slicing = "allow" diff --git a/fish-rust/src/lib.rs b/fish-rust/src/lib.rs index 98ab3ee60..6e6e11aa2 100644 --- a/fish-rust/src/lib.rs +++ b/fish-rust/src/lib.rs @@ -12,9 +12,11 @@ #![allow(clippy::field_reassign_with_default)] #![allow(clippy::get_first)] #![allow(clippy::if_same_then_else)] +#![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::ptr_arg)] #![allow(clippy::redundant_slicing)] diff --git a/fish-rust/src/parse_tree.rs b/fish-rust/src/parse_tree.rs index 73c0e4a66..587231952 100644 --- a/fish-rust/src/parse_tree.rs +++ b/fish-rust/src/parse_tree.rs @@ -162,14 +162,6 @@ impl NodeRef { pub fn parsed_source_ref(&self) -> ParsedSourceRef { Pin::into_inner(self.parsed_source.clone()) } - - /// Construct a NodeRef from ParsedSource and a node, which must point into that parsed source. - pub unsafe fn from_parts(parsed_source: ParsedSourceRef, node: &NodeType) -> Self { - NodeRef { - parsed_source: Pin::new(parsed_source), - node: node as *const NodeType, - } - } } // Safety: NodeRef is Send and Sync because it's just a pointer into a parse tree, which is pinned. diff --git a/fish-rust/src/threads.rs b/fish-rust/src/threads.rs index 5b2900e15..c85d6fba6 100644 --- a/fish-rust/src/threads.rs +++ b/fish-rust/src/threads.rs @@ -487,7 +487,7 @@ pub fn iothread_service_main(ctx: &mut ReaderData) { } /// Does nasty polling via select() and marked as unsafe because it should only be used for testing. -pub unsafe fn iothread_drain_all(ctx: &mut ReaderData) { +pub(crate) unsafe fn iothread_drain_all(ctx: &mut ReaderData) { while borrow_io_thread_pool() .shared .mutex diff --git a/fish-rust/src/wutil/dir_iter.rs b/fish-rust/src/wutil/dir_iter.rs index 8fdbc940b..2ce2a5bce 100644 --- a/fish-rust/src/wutil/dir_iter.rs +++ b/fish-rust/src/wutil/dir_iter.rs @@ -244,6 +244,7 @@ impl DirIter { /// Read the next entry in the directory. /// This returns an error if readir errors, or Ok(None) if there are no more entries; else an Ok entry. /// This is slightly more efficient than the Iterator version, as it avoids allocating. + #[allow(clippy::should_implement_trait)] pub fn next(&mut self) -> Option> { errno::set_errno(errno::Errno(0)); let dent = unsafe { libc::readdir(self.dir.dir()).as_ref() };