Skip to content

Commit 35f360a

Browse files
authored
chore: fix new Clippy lints in Rust 1.83.0 (#3165)
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. This is the `v0.1.x` branch sister PR to #3164 (for the `master` branch), since `clippy --fix` on another branch is a much better way to apply these changes than backporting.
1 parent c66a692 commit 35f360a

File tree

29 files changed

+94
-96
lines changed

29 files changed

+94
-96
lines changed

examples/examples/counters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct Count<'a> {
2828
counters: RwLockReadGuard<'a, HashMap<String, AtomicUsize>>,
2929
}
3030

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

examples/examples/sloggish/sloggish_subscriber.rs

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

8787
struct ColorLevel<'a>(&'a Level);
8888

89-
impl<'a> fmt::Display for ColorLevel<'a> {
89+
impl fmt::Display for ColorLevel<'_> {
9090
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9191
match *self.0 {
9292
Level::TRACE => Color::Purple.paint("TRACE"),
@@ -116,7 +116,7 @@ impl Visit for Span {
116116
}
117117
}
118118

119-
impl<'a> Visit for Event<'a> {
119+
impl Visit for Event<'_> {
120120
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
121121
write!(
122122
&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)]
@@ -801,7 +801,7 @@ struct AsyncTraitBlockReplacer<'a> {
801801
patched_block: Block,
802802
}
803803

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

tracing-core/src/dispatcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ impl<'a> Entered<'a> {
879879
}
880880

881881
#[cfg(feature = "std")]
882-
impl<'a> Drop for Entered<'a> {
882+
impl Drop for Entered<'_> {
883883
#[inline]
884884
fn drop(&mut self) {
885885
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
@@ -387,7 +387,7 @@ where
387387

388388
struct HexBytes<'a>(&'a [u8]);
389389

390-
impl<'a> fmt::Debug for HexBytes<'a> {
390+
impl fmt::Debug for HexBytes<'_> {
391391
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
392392
f.write_char('[')?;
393393

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

408408
// ===== impl Visit =====
409409

410-
impl<'a, 'b> Visit for fmt::DebugStruct<'a, 'b> {
410+
impl Visit for fmt::DebugStruct<'_, '_> {
411411
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
412412
self.field(field.name(), value);
413413
}
414414
}
415415

416-
impl<'a, 'b> Visit for fmt::DebugMap<'a, 'b> {
416+
impl Visit for fmt::DebugMap<'_, '_> {
417417
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
418418
self.entry(&format_args!("{}", field), value);
419419
}
@@ -641,9 +641,9 @@ where
641641
}
642642
}
643643

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

646-
impl<'a> Value for fmt::Arguments<'a> {
646+
impl Value for fmt::Arguments<'_> {
647647
fn record(&self, key: &Field, visitor: &mut dyn Visit) {
648648
visitor.record_debug(key, self)
649649
}
@@ -938,7 +938,7 @@ impl FieldSet {
938938
}
939939
}
940940

941-
impl<'a> IntoIterator for &'a FieldSet {
941+
impl IntoIterator for &FieldSet {
942942
type IntoIter = Iter;
943943
type Item = Field;
944944
#[inline]
@@ -1017,7 +1017,7 @@ impl Iterator for Iter {
10171017

10181018
// ===== impl ValueSet =====
10191019

1020-
impl<'a> ValueSet<'a> {
1020+
impl ValueSet<'_> {
10211021
/// Returns an [`Identifier`] that uniquely identifies the [`Callsite`]
10221022
/// defining the fields this `ValueSet` refers to.
10231023
///
@@ -1078,7 +1078,7 @@ impl<'a> ValueSet<'a> {
10781078
}
10791079
}
10801080

1081-
impl<'a> fmt::Debug for ValueSet<'a> {
1081+
impl fmt::Debug for ValueSet<'_> {
10821082
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10831083
self.values
10841084
.iter()
@@ -1093,7 +1093,7 @@ impl<'a> fmt::Debug for ValueSet<'a> {
10931093
}
10941094
}
10951095

1096-
impl<'a> fmt::Display for ValueSet<'a> {
1096+
impl fmt::Display for ValueSet<'_> {
10971097
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10981098
self.values
10991099
.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);
@@ -332,7 +332,7 @@ impl<'a> Metadata<'a> {
332332
}
333333
}
334334

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

443-
impl<'a> Eq for Metadata<'a> {}
443+
impl Eq for Metadata<'_> {}
444444

445-
impl<'a> PartialEq for Metadata<'a> {
445+
impl PartialEq for Metadata<'_> {
446446
#[inline]
447447
fn eq(&self, other: &Self) -> bool {
448448
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
@@ -212,7 +212,7 @@ pub trait AsTrace: crate::sealed::Sealed {
212212
fn as_trace(&self) -> Self::Trace;
213213
}
214214

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

217217
impl<'a> AsLog for Metadata<'a> {
218218
type Log = log::Metadata<'a>;
@@ -223,7 +223,7 @@ impl<'a> AsLog for Metadata<'a> {
223223
.build()
224224
}
225225
}
226-
impl<'a> crate::sealed::Sealed for log::Metadata<'a> {}
226+
impl crate::sealed::Sealed for log::Metadata<'_> {}
227227

228228
impl<'a> AsTrace for log::Metadata<'a> {
229229
type Trace = Metadata<'a>;
@@ -353,7 +353,7 @@ fn loglevel_to_cs(
353353
}
354354
}
355355

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

358358
impl<'a> AsTrace for log::Record<'a> {
359359
type Trace = Metadata<'a>;
@@ -464,7 +464,7 @@ pub trait NormalizeEvent<'a>: crate::sealed::Sealed {
464464
fn is_log(&self) -> bool;
465465
}
466466

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

469469
impl<'a> NormalizeEvent<'a> for Event<'a> {
470470
fn normalized_metadata(&'a self) -> Option<Metadata<'a>> {
@@ -516,7 +516,7 @@ impl<'a> LogVisitor<'a> {
516516
}
517517
}
518518

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

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

0 commit comments

Comments
 (0)