apply new rustfmt.toml changes, fix some clippy lints

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-12-15 00:05:47 -05:00
parent 0317cc8cc5
commit 77e0b76408
No known key found for this signature in database
296 changed files with 7147 additions and 4300 deletions

View file

@ -22,11 +22,7 @@ type ScopeNames = ArrayVec<&'static str, 32>;
impl Layer {
#[inline]
pub fn new(state: &Arc<State>) -> Self {
Self {
state: state.clone(),
}
}
pub fn new(state: &Arc<State>) -> Self { Self { state: state.clone() } }
}
impl fmt::Debug for Layer {
@ -56,9 +52,7 @@ where
S: Subscriber + for<'a> LookupSpan<'a>,
{
let names = ScopeNames::new();
let mut visitor = Visitor {
values: Values::new(),
};
let mut visitor = Visitor { values: Values::new() };
event.record(&mut visitor);
let mut closure = capture.closure.lock().expect("exclusive lock");
@ -83,7 +77,7 @@ where
}
}
capture.filter.as_ref().map_or(true, |filter| {
capture.filter.as_ref().is_none_or(|filter| {
filter(Data {
layer,
event,
@ -95,7 +89,9 @@ where
}
impl Visit for Visitor {
fn record_debug(&mut self, f: &Field, v: &dyn fmt::Debug) { self.values.push((f.name(), format!("{v:?}"))); }
fn record_debug(&mut self, f: &Field, v: &dyn fmt::Debug) {
self.values.push((f.name(), format!("{v:?}")));
}
fn record_str(&mut self, f: &Field, v: &str) { self.values.push((f.name(), v.to_owned())); }
}

View file

@ -41,9 +41,7 @@ impl Capture {
#[must_use]
pub fn start(self: &Arc<Self>) -> Guard {
self.state.add(self);
Guard {
capture: self.clone(),
}
Guard { capture: self.clone() }
}
pub fn stop(self: &Arc<Self>) { self.state.del(self); }

View file

@ -13,11 +13,7 @@ impl Default for State {
impl State {
#[must_use]
pub fn new() -> Self {
Self {
active: RwLock::new(Vec::new()),
}
}
pub fn new() -> Self { Self { active: RwLock::new(Vec::new()) } }
pub(super) fn add(&self, capture: &Arc<Capture>) {
self.active

View file

@ -5,11 +5,11 @@ use super::Level;
#[must_use]
pub fn html(level: &Level) -> (&'static str, &'static str) {
match *level {
Level::TRACE => ("#000000", "#A0A0A0"),
Level::DEBUG => ("#000000", "#FFFFFF"),
Level::ERROR => ("#000000", "#FF0000"),
Level::WARN => ("#000000", "#FFFF00"),
Level::INFO => ("#FFFFFF", "#008E00"),
| Level::TRACE => ("#000000", "#A0A0A0"),
| Level::DEBUG => ("#000000", "#FFFFFF"),
| Level::ERROR => ("#000000", "#FF0000"),
| Level::WARN => ("#000000", "#FFFF00"),
| Level::INFO => ("#FFFFFF", "#008E00"),
}
}
@ -18,10 +18,10 @@ pub fn html(level: &Level) -> (&'static str, &'static str) {
#[must_use]
pub fn code_tag(level: &Level) -> &'static str {
match *level {
Level::TRACE => "#888888",
Level::DEBUG => "#C8C8C8",
Level::ERROR => "#FF0000",
Level::WARN => "#FFFF00",
Level::INFO => "#00FF00",
| Level::TRACE => "#888888",
| Level::DEBUG => "#C8C8C8",
| Level::ERROR => "#FF0000",
| Level::WARN => "#FFFF00",
| Level::INFO => "#00FF00",
}
}

View file

@ -11,7 +11,8 @@ where
let level = level.as_str().to_uppercase();
write!(
out,
"<font data-mx-color=\"{color}\"><code>{level:>5}</code></font> <code>{span:^12}</code> <code>{msg}</code><br>"
"<font data-mx-color=\"{color}\"><code>{level:>5}</code></font> <code>{span:^12}</code> \
<code>{msg}</code><br>"
)?;
Ok(())

View file

@ -5,13 +5,13 @@ use crate::Result;
#[inline]
pub fn from_str(str: &str) -> Result<FmtSpan, FmtSpan> {
match str.to_uppercase().as_str() {
"ENTER" => Ok(FmtSpan::ENTER),
"EXIT" => Ok(FmtSpan::EXIT),
"NEW" => Ok(FmtSpan::NEW),
"CLOSE" => Ok(FmtSpan::CLOSE),
"ACTIVE" => Ok(FmtSpan::ACTIVE),
"FULL" => Ok(FmtSpan::FULL),
"NONE" => Ok(FmtSpan::NONE),
_ => Err(FmtSpan::NONE),
| "ENTER" => Ok(FmtSpan::ENTER),
| "EXIT" => Ok(FmtSpan::EXIT),
| "NEW" => Ok(FmtSpan::NEW),
| "CLOSE" => Ok(FmtSpan::CLOSE),
| "ACTIVE" => Ok(FmtSpan::ACTIVE),
| "FULL" => Ok(FmtSpan::FULL),
| "NONE" => Ok(FmtSpan::NONE),
| _ => Err(FmtSpan::NONE),
}
}

View file

@ -25,10 +25,7 @@ impl Suppress {
.reload(&suppress, Some(&[handle]))
.expect("log filter reloaded");
Self {
server: server.clone(),
restore,
}
Self { server: server.clone(), restore }
}
}