Fight off some clipplies

This commit is contained in:
Peter Ammon
2025-04-14 20:00:13 -07:00
parent 692b53ab85
commit 85ea9eefc6
5 changed files with 12 additions and 7 deletions

View File

@@ -279,6 +279,7 @@ fn format_a(mut y: f64, params: FormatParams<'_, impl Write>) -> Result<usize, E
// Compute the number of hex digits in the mantissa after the decimal.
// -1 for leading 1 bit (we are to the range [1, 2)), then divide by 4, rounding up.
#[allow(clippy::manual_div_ceil)]
const MANTISSA_HEX_DIGITS: usize = (MANTISSA_BITS - 1 + 3) / 4;
if had_prec && prec < MANTISSA_HEX_DIGITS {
// Decide how many least-significant bits to round off the mantissa.

View File

@@ -132,8 +132,9 @@ pub fn resolve_command(&mut self, cmd: &wstr, env: &dyn Environment) -> Option<A
// HACK: In cargo tests, this used to never load functions
// It will hang for reasons unrelated to this.
#[cfg(test)]
return None;
if cfg!(test) {
return None;
}
#[cfg(feature = "embed-data")]
{

View File

@@ -73,11 +73,13 @@ fn handle(
};
for (arg, want_newline) in arguments(args, optind, streams) {
let trim_start = self.left.then(|| to_trim_start(&arg)).unwrap_or(0);
let trim_start = if self.left { to_trim_start(&arg) } else { 0 };
// collision is only an issue if the whole string is getting trimmed
let trim_end = (self.right && trim_start != arg.len())
.then(|| to_trim_end(&arg))
.unwrap_or(0);
let trim_end = if self.right && trim_start != arg.len() {
to_trim_end(&arg)
} else {
0
};
ntrim += trim_start + trim_end;
if !self.quiet {

View File

@@ -663,6 +663,7 @@ macro_rules! validate {
/// command.
#[test]
#[serial]
#[allow(clippy::needless_range_loop)]
fn test_trailing_spaces_after_command() {
let _cleanup = test_init();
let parser = TestParser::new();

View File

@@ -4,12 +4,12 @@
#![allow(unknown_lints)]
#![allow(unstable_name_collisions)]
#![allow(rustdoc::private_intra_doc_links)]
#![allow(clippy::assigning_clones)]
#![allow(clippy::bool_assert_comparison)]
#![allow(clippy::collapsible_if)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::derivable_impls)]
#![allow(clippy::doc_lazy_continuation)]
#![allow(clippy::doc_overindented_list_items)]
#![allow(clippy::field_reassign_with_default)]
#![allow(clippy::get_first)]
#![allow(clippy::if_same_then_else)]