Fix some clippy lints

This commit is contained in:
ridiculousfish 2023-12-29 12:17:22 -08:00
parent c02cb3b260
commit 7bd8328243
5 changed files with 9 additions and 7 deletions

View File

@ -597,7 +597,7 @@ mod ffi {
is_parent, is_parent,
pid, pid,
desired_pgid, desired_pgid,
job_id.try_into().unwrap(), job_id.into(),
command_str, command_str,
argv0_str, argv0_str,
) )

View File

@ -9,6 +9,7 @@
#![allow(clippy::comparison_chain)] #![allow(clippy::comparison_chain)]
#![allow(clippy::derivable_impls)] #![allow(clippy::derivable_impls)]
#![allow(clippy::field_reassign_with_default)] #![allow(clippy::field_reassign_with_default)]
#![allow(clippy::get_first)]
#![allow(clippy::if_same_then_else)] #![allow(clippy::if_same_then_else)]
#![allow(clippy::manual_is_ascii_check)] #![allow(clippy::manual_is_ascii_check)]
#![allow(clippy::mut_from_ref)] #![allow(clippy::mut_from_ref)]

View File

@ -17,6 +17,7 @@ pub const EXPANSION_LIMIT_DEFAULT: usize = 512 * 1024;
/// A smaller limit for background operations like syntax highlighting. /// A smaller limit for background operations like syntax highlighting.
pub const EXPANSION_LIMIT_BACKGROUND: usize = 512; pub const EXPANSION_LIMIT_BACKGROUND: usize = 512;
#[allow(clippy::enum_variant_names)]
enum Vars<'a> { enum Vars<'a> {
// The parser, if this is a foreground operation. If this is a background operation, this may be // The parser, if this is a foreground operation. If this is a background operation, this may be
// nullptr. // nullptr.

View File

@ -38,7 +38,7 @@ extern "C" fn output_set_color_support(val: u8) {
fn term_supports_color_natively(term: &Term, c: u8) -> bool { fn term_supports_color_natively(term: &Term, c: u8) -> bool {
#[allow(clippy::int_plus_one)] #[allow(clippy::int_plus_one)]
if let Some(max_colors) = term.max_colors { if let Some(max_colors) = term.max_colors {
max_colors >= usize::try_from(c).unwrap() + 1 max_colors >= usize::from(c) + 1
} else { } else {
false false
} }

View File

@ -9,6 +9,11 @@ pub fn add(left: usize, right: usize) -> usize {
left + right left + right
} }
use crate::ffi_tests::add_test;
add_test!("test_add", || {
assert_eq!(add(2, 3), 5);
});
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@ -19,8 +24,3 @@ mod tests {
assert_eq!(result, 4); assert_eq!(result, 4);
} }
} }
use crate::ffi_tests::add_test;
add_test!("test_add", || {
assert_eq!(add(2, 3), 5);
});