Skip to content

Commit d2f47f1

Browse files
authored
chore: fix clippy warnings for v0.1.x (#2552)
## Motivation Clippy check fails in recent CI runs in v0.1.x branch PRs, for example this run: https://github.com/tokio-rs/tracing/actions/runs/4641107803/jobs/8215263838 Relevant error logs: ``` error: lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information --> tracing-core/src/lib.rs:132:5 | 132 | const_err, | ^^^^^^^^^ | = note: `-D renamed-and-removed-lints` implied by `-D warnings` error: deref which would be done by auto-deref --> tracing-core/src/dispatcher.rs:371:26 | 371 | return f(&*entered.current()); | ^^^^^^^^^^^^^^^^^^^ help: try this: `&entered.current()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref = note: `-D clippy::explicit-auto-deref` implied by `-D warnings` error: deref which would be done by auto-deref --> tracing-core/src/dispatcher.rs:393:20 | 393 | Some(f(&*entered.current())) | ^^^^^^^^^^^^^^^^^^^ help: try this: `&entered.current()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref ``` ## Solution Fix the warnings based on the suggestions for Clippy.
1 parent b28c935 commit d2f47f1

File tree

16 files changed

+6
-17
lines changed

16 files changed

+6
-17
lines changed

tracing-appender/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
rust_2018_idioms,
134134
unreachable_pub,
135135
bad_style,
136-
const_err,
137136
dead_code,
138137
improper_ctypes,
139138
non_shorthand_field_patterns,

tracing-attributes/src/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn gen_block<B: ToTokens>(
134134
.into_iter()
135135
.flat_map(|param| match param {
136136
FnArg::Typed(PatType { pat, ty, .. }) => {
137-
param_names(*pat, RecordType::parse_from_ty(&*ty))
137+
param_names(*pat, RecordType::parse_from_ty(&ty))
138138
}
139139
FnArg::Receiver(_) => Box::new(iter::once((
140140
Ident::new("self", param.span()),

tracing-attributes/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
rust_2018_idioms,
6565
unreachable_pub,
6666
bad_style,
67-
const_err,
6867
dead_code,
6968
improper_ctypes,
7069
non_shorthand_field_patterns,

tracing-attributes/tests/ui/async_instrument.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ error[E0308]: mismatched types
9393
42 | async fn extra_semicolon() -> i32 {
9494
| ___________________________________^
9595
43 | | 1;
96-
| | - help: remove this semicolon
96+
| | - help: remove this semicolon to return this value
9797
44 | | }
9898
| |_^ expected `i32`, found `()`

tracing-core/src/dispatcher.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ where
368368
CURRENT_STATE
369369
.try_with(|state| {
370370
if let Some(entered) = state.enter() {
371-
return f(&*entered.current());
371+
return f(&entered.current());
372372
}
373373

374374
f(&Dispatch::none())
@@ -390,7 +390,7 @@ pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
390390
CURRENT_STATE
391391
.try_with(|state| {
392392
let entered = state.enter()?;
393-
Some(f(&*entered.current()))
393+
Some(f(&entered.current()))
394394
})
395395
.ok()?
396396
}

tracing-core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
rust_2018_idioms,
130130
unreachable_pub,
131131
bad_style,
132-
const_err,
133132
dead_code,
134133
improper_ctypes,
135134
non_shorthand_field_patterns,

tracing-error/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@
190190
rust_2018_idioms,
191191
unreachable_pub,
192192
bad_style,
193-
const_err,
194193
dead_code,
195194
improper_ctypes,
196195
non_shorthand_field_patterns,

tracing-flame/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
rust_2018_idioms,
118118
unreachable_pub,
119119
bad_style,
120-
const_err,
121120
dead_code,
122121
improper_ctypes,
123122
non_shorthand_field_patterns,

tracing-futures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
rust_2018_idioms,
8282
unreachable_pub,
8383
bad_style,
84-
const_err,
8584
dead_code,
8685
improper_ctypes,
8786
non_shorthand_field_patterns,

tracing-log/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
rust_2018_idioms,
113113
unreachable_pub,
114114
bad_style,
115-
const_err,
116115
dead_code,
117116
improper_ctypes,
118117
non_shorthand_field_patterns,

tracing-serde/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
rust_2018_idioms,
169169
unreachable_pub,
170170
bad_style,
171-
const_err,
172171
dead_code,
173172
improper_ctypes,
174173
non_shorthand_field_patterns,

tracing-subscriber/src/filter/targets.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl Targets {
324324
/// assert_eq!(filter.default_level(), Some(LevelFilter::OFF));
325325
/// ```
326326
pub fn default_level(&self) -> Option<LevelFilter> {
327-
self.0.directives().into_iter().find_map(|d| {
327+
self.0.directives().find_map(|d| {
328328
if d.target.is_none() {
329329
Some(d.level)
330330
} else {

tracing-subscriber/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@
180180
rust_2018_idioms,
181181
unreachable_pub,
182182
bad_style,
183-
const_err,
184183
dead_code,
185184
improper_ctypes,
186185
non_shorthand_field_patterns,

tracing-subscriber/src/registry/sharded.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl<'a> SpanData<'a> for Data<'a> {
422422
}
423423

424424
fn metadata(&self) -> &'static Metadata<'static> {
425-
(*self).inner.metadata
425+
self.inner.metadata
426426
}
427427

428428
fn parent(&self) -> Option<&Id> {

tracing-tower/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
rust_2018_idioms,
1010
unreachable_pub,
1111
bad_style,
12-
const_err,
1312
dead_code,
1413
improper_ctypes,
1514
non_shorthand_field_patterns,

tracing/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,6 @@
911911
rust_2018_idioms,
912912
unreachable_pub,
913913
bad_style,
914-
const_err,
915914
dead_code,
916915
improper_ctypes,
917916
non_shorthand_field_patterns,

0 commit comments

Comments
 (0)