Skip to content

Commit c8049f6

Browse files
authored
chore: fix new Clippy lints in Rust 1.83.0 (#3164)
Most of these changes are places where lifetimes were named, but can be elided. Then a few cases where a lifetime was elided, but actually resolves to a named lifetime. So lots of lifetimes.
1 parent 827cd14 commit c8049f6

File tree

31 files changed

+96
-101
lines changed

31 files changed

+96
-101
lines changed

examples/examples/counters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct Count<'a> {
3131
counters: RwLockReadGuard<'a, HashMap<String, AtomicUsize>>,
3232
}
3333

34-
impl<'a> Visit for Count<'a> {
34+
impl Visit for Count<'_> {
3535
fn record_i64(&mut self, field: &Field, value: i64) {
3636
if let Some(counter) = self.counters.get(field.name()) {
3737
if value > 0 {

examples/examples/sloggish/sloggish_collector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct Event<'a> {
7878

7979
struct ColorLevel<'a>(&'a Level);
8080

81-
impl<'a> fmt::Display for ColorLevel<'a> {
81+
impl fmt::Display for ColorLevel<'_> {
8282
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8383
match *self.0 {
8484
Level::TRACE => Color::Purple.paint("TRACE"),
@@ -109,7 +109,7 @@ impl Visit for Span {
109109
}
110110
}
111111

112-
impl<'a> Visit for Event<'a> {
112+
impl Visit for Event<'_> {
113113
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
114114
write!(
115115
&mut self.stderr,

tracing-appender/benches/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl NoOpWriter {
1818
}
1919
}
2020

21-
impl<'a> MakeWriter<'a> for NoOpWriter {
21+
impl MakeWriter<'_> for NoOpWriter {
2222
type Writer = NoOpWriter;
2323

2424
fn make_writer(&self) -> Self::Writer {

tracing-appender/src/rolling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub use builder::{Builder, InitError};
7070
///
7171
/// // Log all events to a rolling log file.
7272
/// let logfile = tracing_appender::rolling::hourly("/logs", "myapp-logs");
73-
73+
///
7474
/// // Log `INFO` and above to stdout.
7575
/// let stdout = std::io::stdout.with_max_level(tracing::Level::INFO);
7676
///

tracing-attributes/src/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ struct IdentAndTypesRenamer<'a> {
772772
idents: Vec<(Ident, Ident)>,
773773
}
774774

775-
impl<'a> VisitMut for IdentAndTypesRenamer<'a> {
775+
impl VisitMut for IdentAndTypesRenamer<'_> {
776776
// we deliberately compare strings because we want to ignore the spans
777777
// If we apply clippy's lint, the behavior changes
778778
#[allow(clippy::cmp_owned)]
@@ -802,7 +802,7 @@ struct AsyncTraitBlockReplacer<'a> {
802802
patched_block: Block,
803803
}
804804

805-
impl<'a> VisitMut for AsyncTraitBlockReplacer<'a> {
805+
impl VisitMut for AsyncTraitBlockReplacer<'_> {
806806
fn visit_block_mut(&mut self, i: &mut Block) {
807807
if i == self.block {
808808
*i = self.patched_block.clone();

tracing-core/src/dispatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ where
436436
// the default dispatcher will not be able to access the dispatch context.
437437
// Dropping the guard will allow the dispatch context to be re-entered.
438438
struct Entered<'a>(&'a Cell<bool>);
439-
impl<'a> Drop for Entered<'a> {
439+
impl Drop for Entered<'_> {
440440
#[inline]
441441
fn drop(&mut self) {
442442
self.0.set(true);
@@ -1039,7 +1039,7 @@ impl<'a> Entered<'a> {
10391039
}
10401040

10411041
#[cfg(feature = "std")]
1042-
impl<'a> Drop for Entered<'a> {
1042+
impl Drop for Entered<'_> {
10431043
#[inline]
10441044
fn drop(&mut self) {
10451045
self.0.can_enter.set(true);

tracing-core/src/field.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ where
290290

291291
struct HexBytes<'a>(&'a [u8]);
292292

293-
impl<'a> fmt::Debug for HexBytes<'a> {
293+
impl fmt::Debug for HexBytes<'_> {
294294
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
295295
f.write_char('[')?;
296296

@@ -310,13 +310,13 @@ impl<'a> fmt::Debug for HexBytes<'a> {
310310

311311
// ===== impl Visit =====
312312

313-
impl<'a, 'b> Visit for fmt::DebugStruct<'a, 'b> {
313+
impl Visit for fmt::DebugStruct<'_, '_> {
314314
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
315315
self.field(field.name(), value);
316316
}
317317
}
318318

319-
impl<'a, 'b> Visit for fmt::DebugMap<'a, 'b> {
319+
impl Visit for fmt::DebugMap<'_, '_> {
320320
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
321321
self.entry(&format_args!("{}", field), value);
322322
}
@@ -544,9 +544,9 @@ where
544544
}
545545
}
546546

547-
impl<'a> crate::sealed::Sealed for fmt::Arguments<'a> {}
547+
impl crate::sealed::Sealed for fmt::Arguments<'_> {}
548548

549-
impl<'a> Value for fmt::Arguments<'a> {
549+
impl Value for fmt::Arguments<'_> {
550550
fn record(&self, key: &Field, visitor: &mut dyn Visit) {
551551
visitor.record_debug(key, self)
552552
}
@@ -818,7 +818,7 @@ impl FieldSet {
818818
}
819819
}
820820

821-
impl<'a> IntoIterator for &'a FieldSet {
821+
impl IntoIterator for &FieldSet {
822822
type IntoIter = Iter;
823823
type Item = Field;
824824
#[inline]
@@ -897,7 +897,7 @@ impl Iterator for Iter {
897897

898898
// ===== impl ValueSet =====
899899

900-
impl<'a> ValueSet<'a> {
900+
impl ValueSet<'_> {
901901
/// Returns an [`Identifier`] that uniquely identifies the [`Callsite`]
902902
/// defining the fields this `ValueSet` refers to.
903903
///
@@ -958,7 +958,7 @@ impl<'a> ValueSet<'a> {
958958
}
959959
}
960960

961-
impl<'a> fmt::Debug for ValueSet<'a> {
961+
impl fmt::Debug for ValueSet<'_> {
962962
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
963963
self.values
964964
.iter()
@@ -973,7 +973,7 @@ impl<'a> fmt::Debug for ValueSet<'a> {
973973
}
974974
}
975975

976-
impl<'a> fmt::Display for ValueSet<'a> {
976+
impl fmt::Display for ValueSet<'_> {
977977
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
978978
self.values
979979
.iter()

tracing-core/src/metadata.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub struct Kind(u8);
191191
/// // ...
192192
/// # drop(span); Id::from_u64(1)
193193
/// }
194-
194+
///
195195
/// fn event(&self, event: &Event<'_>) {
196196
/// // ...
197197
/// # drop(event);
@@ -333,7 +333,7 @@ impl<'a> Metadata<'a> {
333333
}
334334
}
335335

336-
impl<'a> fmt::Debug for Metadata<'a> {
336+
impl fmt::Debug for Metadata<'_> {
337337
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
338338
let mut meta = f.debug_struct("Metadata");
339339
meta.field("name", &self.name)
@@ -441,9 +441,9 @@ impl fmt::Debug for Kind {
441441
}
442442
}
443443

444-
impl<'a> Eq for Metadata<'a> {}
444+
impl Eq for Metadata<'_> {}
445445

446-
impl<'a> PartialEq for Metadata<'a> {
446+
impl PartialEq for Metadata<'_> {
447447
#[inline]
448448
fn eq(&self, other: &Self) -> bool {
449449
if core::ptr::eq(&self, &other) {

tracing-error/src/backtrace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl fmt::Debug for SpanTrace {
227227
fields: &'a str,
228228
}
229229

230-
impl<'a> fmt::Debug for DebugSpan<'a> {
230+
impl fmt::Debug for DebugSpan<'_> {
231231
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
232232
write!(
233233
f,

tracing-log/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub trait AsTrace: crate::sealed::Sealed {
209209
fn as_trace(&self) -> Self::Trace;
210210
}
211211

212-
impl<'a> crate::sealed::Sealed for Metadata<'a> {}
212+
impl crate::sealed::Sealed for Metadata<'_> {}
213213

214214
impl<'a> AsLog for Metadata<'a> {
215215
type Log = log::Metadata<'a>;
@@ -220,7 +220,7 @@ impl<'a> AsLog for Metadata<'a> {
220220
.build()
221221
}
222222
}
223-
impl<'a> crate::sealed::Sealed for log::Metadata<'a> {}
223+
impl crate::sealed::Sealed for log::Metadata<'_> {}
224224

225225
impl<'a> AsTrace for log::Metadata<'a> {
226226
type Trace = Metadata<'a>;
@@ -350,7 +350,7 @@ fn loglevel_to_cs(
350350
}
351351
}
352352

353-
impl<'a> crate::sealed::Sealed for log::Record<'a> {}
353+
impl crate::sealed::Sealed for log::Record<'_> {}
354354

355355
impl<'a> AsTrace for log::Record<'a> {
356356
type Trace = Metadata<'a>;
@@ -461,7 +461,7 @@ pub trait NormalizeEvent<'a>: crate::sealed::Sealed {
461461
fn is_log(&self) -> bool;
462462
}
463463

464-
impl<'a> crate::sealed::Sealed for Event<'a> {}
464+
impl crate::sealed::Sealed for Event<'_> {}
465465

466466
impl<'a> NormalizeEvent<'a> for Event<'a> {
467467
fn normalized_metadata(&'a self) -> Option<Metadata<'a>> {
@@ -513,7 +513,7 @@ impl<'a> LogVisitor<'a> {
513513
}
514514
}
515515

516-
impl<'a> Visit for LogVisitor<'a> {
516+
impl Visit for LogVisitor<'_> {
517517
fn record_debug(&mut self, _field: &Field, _value: &dyn fmt::Debug) {}
518518

519519
fn record_u64(&mut self, field: &Field, value: u64) {

0 commit comments

Comments
 (0)