From 6240c95518640d9eb41207ac24c61dd7d9e4953b Mon Sep 17 00:00:00 2001 From: Hayden Stainsby Date: Fri, 24 Jan 2025 18:38:57 +0100 Subject: [PATCH] chore: fix Rust 1.84.0 lints and errors (#3202) There was only a single case of the new `needless_as_bytes` lint which was triggered and needed to be fixed. There was also a "UI" test in `tracing-attributes` that needed to be updated because the error text has changed (it gives more details of course). --- tracing-attributes/tests/ui/async_instrument.stderr | 5 ++++- tracing-subscriber/src/fmt/writer.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tracing-attributes/tests/ui/async_instrument.stderr b/tracing-attributes/tests/ui/async_instrument.stderr index 2c64b0c1..e0aa0d62 100644 --- a/tracing-attributes/tests/ui/async_instrument.stderr +++ b/tracing-attributes/tests/ui/async_instrument.stderr @@ -28,7 +28,10 @@ error[E0277]: `(&str,)` doesn't implement `std::fmt::Display` --> tests/ui/async_instrument.rs:14:1 | 14 | #[tracing::instrument] - | ^^^^^^^^^^^^^^^^^^^^^^ `(&str,)` cannot be formatted with the default formatter + | ^^^^^^^^^^^^^^^^^^^^^^ + | | + | `(&str,)` cannot be formatted with the default formatter + | return type was inferred to be `(&str,)` here | = help: the trait `std::fmt::Display` is not implemented for `(&str,)` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead diff --git a/tracing-subscriber/src/fmt/writer.rs b/tracing-subscriber/src/fmt/writer.rs index 52e222c8..a20626a2 100644 --- a/tracing-subscriber/src/fmt/writer.rs +++ b/tracing-subscriber/src/fmt/writer.rs @@ -1186,7 +1186,7 @@ impl io::Write for WriteAdaptor<'_> { .write_str(s) .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; - Ok(s.as_bytes().len()) + Ok(s.len()) } fn flush(&mut self) -> io::Result<()> {