Another batch of lint fixes (#36521)

- **Enable a bunch of extra lints**
- **First batch of fixes**
- **More fixes**

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 22:33:44 +02:00 committed by GitHub
parent 69b1c6d6f5
commit 6825715503
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 788 additions and 1042 deletions

View file

@ -4,7 +4,6 @@ use std::{
OnceLock, RwLock,
atomic::{AtomicU8, Ordering},
},
usize,
};
use crate::{SCOPE_DEPTH_MAX, SCOPE_STRING_SEP_STR, Scope, ScopeAlloc, env_config, private};
@ -152,7 +151,7 @@ fn scope_alloc_from_scope_str(scope_str: &str) -> Option<ScopeAlloc> {
if index == 0 {
return None;
}
if let Some(_) = scope_iter.next() {
if scope_iter.next().is_some() {
crate::warn!(
"Invalid scope key, too many nested scopes: '{scope_str}'. Max depth is {SCOPE_DEPTH_MAX}",
);
@ -204,12 +203,10 @@ impl ScopeMap {
.map(|(scope_str, level_filter)| (scope_str.as_str(), *level_filter))
});
let new_filters = items_input_map
.into_iter()
.filter_map(|(scope_str, level_str)| {
let level_filter = level_filter_from_str(level_str)?;
Some((scope_str.as_str(), level_filter))
});
let new_filters = items_input_map.iter().filter_map(|(scope_str, level_str)| {
let level_filter = level_filter_from_str(level_str)?;
Some((scope_str.as_str(), level_filter))
});
let all_filters = default_filters
.iter()

View file

@ -10,12 +10,9 @@ pub use sink::{flush, init_output_file, init_output_stderr, init_output_stdout};
pub const SCOPE_DEPTH_MAX: usize = 4;
pub fn init() {
match try_init() {
Err(err) => {
log::error!("{err}");
eprintln!("{err}");
}
Ok(()) => {}
if let Err(err) = try_init() {
log::error!("{err}");
eprintln!("{err}");
}
}
@ -268,7 +265,7 @@ pub mod private {
pub type Scope = [&'static str; SCOPE_DEPTH_MAX];
pub type ScopeAlloc = [String; SCOPE_DEPTH_MAX];
const SCOPE_STRING_SEP_STR: &'static str = ".";
const SCOPE_STRING_SEP_STR: &str = ".";
const SCOPE_STRING_SEP_CHAR: char = '.';
#[derive(Clone, Copy, Debug, PartialEq, Eq)]