mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-09-28 13:31:52 +00:00
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 <https://github.com/rust-lang/rust/issues/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.
This commit is contained in:
parent
b28c9351dd
commit
d2f47f1e3f
@ -133,7 +133,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -134,7 +134,7 @@ fn gen_block<B: ToTokens>(
|
||||
.into_iter()
|
||||
.flat_map(|param| match param {
|
||||
FnArg::Typed(PatType { pat, ty, .. }) => {
|
||||
param_names(*pat, RecordType::parse_from_ty(&*ty))
|
||||
param_names(*pat, RecordType::parse_from_ty(&ty))
|
||||
}
|
||||
FnArg::Receiver(_) => Box::new(iter::once((
|
||||
Ident::new("self", param.span()),
|
||||
|
@ -64,7 +64,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -93,6 +93,6 @@ error[E0308]: mismatched types
|
||||
42 | async fn extra_semicolon() -> i32 {
|
||||
| ___________________________________^
|
||||
43 | | 1;
|
||||
| | - help: remove this semicolon
|
||||
| | - help: remove this semicolon to return this value
|
||||
44 | | }
|
||||
| |_^ expected `i32`, found `()`
|
||||
|
@ -368,7 +368,7 @@ where
|
||||
CURRENT_STATE
|
||||
.try_with(|state| {
|
||||
if let Some(entered) = state.enter() {
|
||||
return f(&*entered.current());
|
||||
return f(&entered.current());
|
||||
}
|
||||
|
||||
f(&Dispatch::none())
|
||||
@ -390,7 +390,7 @@ pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
|
||||
CURRENT_STATE
|
||||
.try_with(|state| {
|
||||
let entered = state.enter()?;
|
||||
Some(f(&*entered.current()))
|
||||
Some(f(&entered.current()))
|
||||
})
|
||||
.ok()?
|
||||
}
|
||||
|
@ -129,7 +129,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -190,7 +190,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -117,7 +117,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -81,7 +81,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -112,7 +112,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -168,7 +168,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -324,7 +324,7 @@ impl Targets {
|
||||
/// assert_eq!(filter.default_level(), Some(LevelFilter::OFF));
|
||||
/// ```
|
||||
pub fn default_level(&self) -> Option<LevelFilter> {
|
||||
self.0.directives().into_iter().find_map(|d| {
|
||||
self.0.directives().find_map(|d| {
|
||||
if d.target.is_none() {
|
||||
Some(d.level)
|
||||
} else {
|
||||
|
@ -180,7 +180,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -422,7 +422,7 @@ impl<'a> SpanData<'a> for Data<'a> {
|
||||
}
|
||||
|
||||
fn metadata(&self) -> &'static Metadata<'static> {
|
||||
(*self).inner.metadata
|
||||
self.inner.metadata
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<&Id> {
|
||||
|
@ -9,7 +9,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
@ -911,7 +911,6 @@
|
||||
rust_2018_idioms,
|
||||
unreachable_pub,
|
||||
bad_style,
|
||||
const_err,
|
||||
dead_code,
|
||||
improper_ctypes,
|
||||
non_shorthand_field_patterns,
|
||||
|
Loading…
x
Reference in New Issue
Block a user