Fix many clippy lints

This commit is contained in:
Speedy_Lex
2026-04-25 21:00:46 +02:00
parent eebd41a187
commit eff610eac6
21 changed files with 131 additions and 164 deletions
+3 -13
View File
@@ -92,17 +92,7 @@ impl<L: LogSink> LogParams<L> {
.unwrap_or(true)
{
// Try reopening the log file once and retrying as musl does.
if !self
.open_logger()
.is_ok()
.then(|| {
self.writer
.as_mut()
.map(|w| w.writer().write_all(&buffer).is_ok())
.unwrap_or_default()
})
.unwrap_or_default()
&& self.opt.contains(Config::Console)
if !(self.open_logger().is_ok() && self.writer.as_mut().and_then(|w| w.writer().write_all(&buffer).ok()).is_some()) && self.opt.contains(Config::Console)
{
// TODO: Log error to /dev/console & Redox equivalent
}
@@ -139,10 +129,10 @@ impl<L: LogSink> LogParams<L> {
/// default.
pub fn set_identity(&mut self, ident: Option<&str>) {
self.ident = ident
.and_then(|ident| {
.map(|ident| {
let ident = ident.bytes().chain([0]).collect();
// SAFETY: Already validated
Some(unsafe { String::from_utf8_unchecked(ident) })
unsafe { String::from_utf8_unchecked(ident) }
})
.unwrap_or_else(|| {
unsafe { CStr::from_nullable_ptr(platform::program_invocation_short_name) }