Address clippy lints on stable Rust

This commit is contained in:
Johannes Altmanninger 2024-01-12 14:07:54 +01:00
parent 6896898769
commit 4bae1f3de9
5 changed files with 6 additions and 9 deletions

View file

@ -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"

View file

@ -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)]

View file

@ -162,14 +162,6 @@ impl<NodeType: Node> NodeRef<NodeType> {
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.

View file

@ -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

View file

@ -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<io::Result<&DirEntry>> {
errno::set_errno(errno::Errno(0));
let dent = unsafe { libc::readdir(self.dir.dir()).as_ref() };