From 7bd832824308b0d3268eac4842340a6b98809e64 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 29 Dec 2023 12:17:22 -0800 Subject: [PATCH] Fix some clippy lints --- fish-rust/src/fork_exec/postfork.rs | 2 +- fish-rust/src/lib.rs | 1 + fish-rust/src/operation_context.rs | 1 + fish-rust/src/output.rs | 2 +- fish-rust/src/smoke.rs | 10 +++++----- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fish-rust/src/fork_exec/postfork.rs b/fish-rust/src/fork_exec/postfork.rs index 070810b9e..54a4190c0 100644 --- a/fish-rust/src/fork_exec/postfork.rs +++ b/fish-rust/src/fork_exec/postfork.rs @@ -597,7 +597,7 @@ pub extern "C" fn report_setpgid_error( is_parent, pid, desired_pgid, - job_id.try_into().unwrap(), + job_id.into(), command_str, argv0_str, ) diff --git a/fish-rust/src/lib.rs b/fish-rust/src/lib.rs index c5ac160ef..b27b66e0e 100644 --- a/fish-rust/src/lib.rs +++ b/fish-rust/src/lib.rs @@ -9,6 +9,7 @@ #![allow(clippy::comparison_chain)] #![allow(clippy::derivable_impls)] #![allow(clippy::field_reassign_with_default)] +#![allow(clippy::get_first)] #![allow(clippy::if_same_then_else)] #![allow(clippy::manual_is_ascii_check)] #![allow(clippy::mut_from_ref)] diff --git a/fish-rust/src/operation_context.rs b/fish-rust/src/operation_context.rs index 584874029..37b11a788 100644 --- a/fish-rust/src/operation_context.rs +++ b/fish-rust/src/operation_context.rs @@ -17,6 +17,7 @@ pub fn no_cancel() -> bool { /// A smaller limit for background operations like syntax highlighting. pub const EXPANSION_LIMIT_BACKGROUND: usize = 512; +#[allow(clippy::enum_variant_names)] enum Vars<'a> { // The parser, if this is a foreground operation. If this is a background operation, this may be // nullptr. diff --git a/fish-rust/src/output.rs b/fish-rust/src/output.rs index ceb78754d..3f0a488fe 100644 --- a/fish-rust/src/output.rs +++ b/fish-rust/src/output.rs @@ -38,7 +38,7 @@ extern "C" fn output_set_color_support(val: u8) { fn term_supports_color_natively(term: &Term, c: u8) -> bool { #[allow(clippy::int_plus_one)] if let Some(max_colors) = term.max_colors { - max_colors >= usize::try_from(c).unwrap() + 1 + max_colors >= usize::from(c) + 1 } else { false } diff --git a/fish-rust/src/smoke.rs b/fish-rust/src/smoke.rs index 853db4dc6..0d07a5db0 100644 --- a/fish-rust/src/smoke.rs +++ b/fish-rust/src/smoke.rs @@ -9,6 +9,11 @@ pub fn add(left: usize, right: usize) -> usize { left + right } +use crate::ffi_tests::add_test; +add_test!("test_add", || { + assert_eq!(add(2, 3), 5); +}); + #[cfg(test)] mod tests { use super::*; @@ -19,8 +24,3 @@ fn it_works() { assert_eq!(result, 4); } } - -use crate::ffi_tests::add_test; -add_test!("test_add", || { - assert_eq!(add(2, 3), 5); -});