mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Mark let_underscore_drop
as uplifted
This commit is contained in:
parent
4f142aa105
commit
ff893366c1
15 changed files with 121 additions and 253 deletions
|
@ -1,7 +1,6 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::ty::{is_must_use_ty, is_type_diagnostic_item, match_type};
|
||||
use clippy_utils::{is_must_use_func_call, paths};
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Local, PatKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
|
@ -60,45 +59,7 @@ declare_clippy_lint! {
|
|||
"non-binding let on a synchronization lock"
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for `let _ = <expr>`
|
||||
/// where expr has a type that implements `Drop`
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// This statement immediately drops the initializer
|
||||
/// expression instead of extending its lifetime to the end of the scope, which
|
||||
/// is often not intended. To extend the expression's lifetime to the end of the
|
||||
/// scope, use an underscore-prefixed name instead (i.e. _var). If you want to
|
||||
/// explicitly drop the expression, `std::mem::drop` conveys your intention
|
||||
/// better and is less error-prone.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust
|
||||
/// # struct DroppableItem;
|
||||
/// {
|
||||
/// let _ = DroppableItem;
|
||||
/// // ^ dropped here
|
||||
/// /* more code */
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```rust
|
||||
/// # struct DroppableItem;
|
||||
/// {
|
||||
/// let _droppable = DroppableItem;
|
||||
/// /* more code */
|
||||
/// // dropped at end of scope
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.50.0"]
|
||||
pub LET_UNDERSCORE_DROP,
|
||||
pedantic,
|
||||
"non-binding let on a type that implements `Drop`"
|
||||
}
|
||||
|
||||
declare_lint_pass!(LetUnderscore => [LET_UNDERSCORE_MUST_USE, LET_UNDERSCORE_LOCK, LET_UNDERSCORE_DROP]);
|
||||
declare_lint_pass!(LetUnderscore => [LET_UNDERSCORE_MUST_USE, LET_UNDERSCORE_LOCK]);
|
||||
|
||||
const SYNC_GUARD_SYMS: [Symbol; 3] = [sym::MutexGuard, sym::RwLockReadGuard, sym::RwLockWriteGuard];
|
||||
|
||||
|
@ -110,64 +71,49 @@ const SYNC_GUARD_PATHS: [&[&str]; 3] = [
|
|||
|
||||
impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
|
||||
fn check_local(&mut self, cx: &LateContext<'_>, local: &Local<'_>) {
|
||||
if in_external_macro(cx.tcx.sess, local.span) {
|
||||
return;
|
||||
}
|
||||
if !in_external_macro(cx.tcx.sess, local.span)
|
||||
&& let PatKind::Wild = local.pat.kind
|
||||
&& let Some(init) = local.init
|
||||
{
|
||||
let init_ty = cx.typeck_results().expr_ty(init);
|
||||
let contains_sync_guard = init_ty.walk().any(|inner| match inner.unpack() {
|
||||
GenericArgKind::Type(inner_ty) => {
|
||||
SYNC_GUARD_SYMS
|
||||
.iter()
|
||||
.any(|&sym| is_type_diagnostic_item(cx, inner_ty, sym))
|
||||
|| SYNC_GUARD_PATHS.iter().any(|path| match_type(cx, inner_ty, path))
|
||||
},
|
||||
|
||||
if_chain! {
|
||||
if let PatKind::Wild = local.pat.kind;
|
||||
if let Some(init) = local.init;
|
||||
then {
|
||||
let init_ty = cx.typeck_results().expr_ty(init);
|
||||
let contains_sync_guard = init_ty.walk().any(|inner| match inner.unpack() {
|
||||
GenericArgKind::Type(inner_ty) => {
|
||||
SYNC_GUARD_SYMS
|
||||
.iter()
|
||||
.any(|&sym| is_type_diagnostic_item(cx, inner_ty, sym))
|
||||
|| SYNC_GUARD_PATHS.iter().any(|path| match_type(cx, inner_ty, path))
|
||||
},
|
||||
|
||||
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_) => false,
|
||||
});
|
||||
if contains_sync_guard {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_LOCK,
|
||||
local.span,
|
||||
"non-binding let on a synchronization lock",
|
||||
None,
|
||||
"consider using an underscore-prefixed named \
|
||||
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_) => false,
|
||||
});
|
||||
if contains_sync_guard {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_LOCK,
|
||||
local.span,
|
||||
"non-binding let on a synchronization lock",
|
||||
None,
|
||||
"consider using an underscore-prefixed named \
|
||||
binding or dropping explicitly with `std::mem::drop`",
|
||||
);
|
||||
} else if init_ty.needs_drop(cx.tcx, cx.param_env) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_DROP,
|
||||
local.span,
|
||||
"non-binding `let` on a type that implements `Drop`",
|
||||
None,
|
||||
"consider using an underscore-prefixed named \
|
||||
binding or dropping explicitly with `std::mem::drop`",
|
||||
);
|
||||
} else if is_must_use_ty(cx, cx.typeck_results().expr_ty(init)) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_MUST_USE,
|
||||
local.span,
|
||||
"non-binding let on an expression with `#[must_use]` type",
|
||||
None,
|
||||
"consider explicitly using expression value",
|
||||
);
|
||||
} else if is_must_use_func_call(cx, init) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_MUST_USE,
|
||||
local.span,
|
||||
"non-binding let on a result of a `#[must_use]` function",
|
||||
None,
|
||||
"consider explicitly using function result",
|
||||
);
|
||||
}
|
||||
);
|
||||
} else if is_must_use_ty(cx, cx.typeck_results().expr_ty(init)) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_MUST_USE,
|
||||
local.span,
|
||||
"non-binding let on an expression with `#[must_use]` type",
|
||||
None,
|
||||
"consider explicitly using expression value",
|
||||
);
|
||||
} else if is_must_use_func_call(cx, init) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
LET_UNDERSCORE_MUST_USE,
|
||||
local.span,
|
||||
"non-binding let on a result of a `#[must_use]` function",
|
||||
None,
|
||||
"consider explicitly using function result",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,6 @@ store.register_lints(&[
|
|||
len_zero::LEN_WITHOUT_IS_EMPTY,
|
||||
len_zero::LEN_ZERO,
|
||||
let_if_seq::USELESS_LET_IF_SEQ,
|
||||
let_underscore::LET_UNDERSCORE_DROP,
|
||||
let_underscore::LET_UNDERSCORE_LOCK,
|
||||
let_underscore::LET_UNDERSCORE_MUST_USE,
|
||||
lifetimes::EXTRA_UNUSED_LIFETIMES,
|
||||
|
|
|
@ -39,7 +39,6 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
|
|||
LintId::of(items_after_statements::ITEMS_AFTER_STATEMENTS),
|
||||
LintId::of(iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR),
|
||||
LintId::of(large_stack_arrays::LARGE_STACK_ARRAYS),
|
||||
LintId::of(let_underscore::LET_UNDERSCORE_DROP),
|
||||
LintId::of(literal_representation::LARGE_DIGIT_GROUPS),
|
||||
LintId::of(literal_representation::UNREADABLE_LITERAL),
|
||||
LintId::of(loops::EXPLICIT_INTO_ITER_LOOP),
|
||||
|
|
|
@ -11,8 +11,6 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
|
|||
("clippy::disallowed_method", "clippy::disallowed_methods"),
|
||||
("clippy::disallowed_type", "clippy::disallowed_types"),
|
||||
("clippy::eval_order_dependence", "clippy::mixed_read_write_in_expression"),
|
||||
("clippy::for_loop_over_option", "for_loops_over_fallibles"),
|
||||
("clippy::for_loop_over_result", "for_loops_over_fallibles"),
|
||||
("clippy::identity_conversion", "clippy::useless_conversion"),
|
||||
("clippy::if_let_some_result", "clippy::match_result_ok"),
|
||||
("clippy::logic_bug", "clippy::overly_complex_bool_expr"),
|
||||
|
@ -31,10 +29,13 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
|
|||
("clippy::to_string_in_display", "clippy::recursive_format_impl"),
|
||||
("clippy::zero_width_space", "clippy::invisible_characters"),
|
||||
("clippy::drop_bounds", "drop_bounds"),
|
||||
("clippy::for_loop_over_option", "for_loops_over_fallibles"),
|
||||
("clippy::for_loop_over_result", "for_loops_over_fallibles"),
|
||||
("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"),
|
||||
("clippy::into_iter_on_array", "array_into_iter"),
|
||||
("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"),
|
||||
("clippy::invalid_ref", "invalid_value"),
|
||||
("clippy::let_underscore_drop", "let_underscore_drop"),
|
||||
("clippy::mem_discriminant_non_enum", "enum_intrinsics_non_enums"),
|
||||
("clippy::panic_params", "non_fmt_panics"),
|
||||
("clippy::positional_named_format_parameters", "named_arguments_used_positionally"),
|
||||
|
|
|
@ -678,7 +678,7 @@ fn main() {
|
|||
.unwrap();
|
||||
|
||||
let server = config.recursive.then(|| {
|
||||
fs::remove_dir_all("target/lintcheck/shared_target_dir/recursive").unwrap_or_default();
|
||||
let _ = fs::remove_dir_all("target/lintcheck/shared_target_dir/recursive");
|
||||
|
||||
LintcheckServer::spawn(recursive_options)
|
||||
});
|
||||
|
|
|
@ -247,7 +247,6 @@ docs! {
|
|||
"len_without_is_empty",
|
||||
"len_zero",
|
||||
"let_and_return",
|
||||
"let_underscore_drop",
|
||||
"let_underscore_lock",
|
||||
"let_underscore_must_use",
|
||||
"let_unit_value",
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
### What it does
|
||||
Checks for `let _ = <expr>`
|
||||
where expr has a type that implements `Drop`
|
||||
|
||||
### Why is this bad?
|
||||
This statement immediately drops the initializer
|
||||
expression instead of extending its lifetime to the end of the scope, which
|
||||
is often not intended. To extend the expression's lifetime to the end of the
|
||||
scope, use an underscore-prefixed name instead (i.e. _var). If you want to
|
||||
explicitly drop the expression, `std::mem::drop` conveys your intention
|
||||
better and is less error-prone.
|
||||
|
||||
### Example
|
||||
```
|
||||
{
|
||||
let _ = DroppableItem;
|
||||
// ^ dropped here
|
||||
/* more code */
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
{
|
||||
let _droppable = DroppableItem;
|
||||
/* more code */
|
||||
// dropped at end of scope
|
||||
}
|
||||
```
|
|
@ -1,28 +0,0 @@
|
|||
#![warn(clippy::let_underscore_drop)]
|
||||
#![allow(clippy::let_unit_value)]
|
||||
|
||||
struct Droppable;
|
||||
|
||||
impl Drop for Droppable {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let unit = ();
|
||||
let boxed = Box::new(());
|
||||
let droppable = Droppable;
|
||||
let optional = Some(Droppable);
|
||||
|
||||
let _ = ();
|
||||
let _ = Box::new(());
|
||||
let _ = Droppable;
|
||||
let _ = Some(Droppable);
|
||||
|
||||
// no lint for reference
|
||||
let _ = droppable_ref();
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn droppable_ref() -> &'static mut Droppable {
|
||||
unimplemented!()
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
error: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/let_underscore_drop.rs:17:5
|
||||
|
|
||||
LL | let _ = Box::new(());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
= note: `-D clippy::let-underscore-drop` implied by `-D warnings`
|
||||
|
||||
error: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/let_underscore_drop.rs:18:5
|
||||
|
|
||||
LL | let _ = Droppable;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/let_underscore_drop.rs:19:5
|
||||
|
|
||||
LL | let _ = Some(Droppable);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::let_underscore_drop)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
#![allow(clippy::map_identity)]
|
||||
#![allow(clippy::redundant_closure)]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::let_underscore_drop)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
#![allow(clippy::map_identity)]
|
||||
#![allow(clippy::redundant_closure)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: called `map(..).flatten()` on `Iterator`
|
||||
--> $DIR/map_flatten_fixable.rs:18:47
|
||||
--> $DIR/map_flatten_fixable.rs:17:47
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id)`
|
||||
|
@ -7,43 +7,43 @@ LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().coll
|
|||
= note: `-D clippy::map-flatten` implied by `-D warnings`
|
||||
|
||||
error: called `map(..).flatten()` on `Iterator`
|
||||
--> $DIR/map_flatten_fixable.rs:19:47
|
||||
--> $DIR/map_flatten_fixable.rs:18:47
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_ref)`
|
||||
|
||||
error: called `map(..).flatten()` on `Iterator`
|
||||
--> $DIR/map_flatten_fixable.rs:20:47
|
||||
--> $DIR/map_flatten_fixable.rs:19:47
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_closure)`
|
||||
|
||||
error: called `map(..).flatten()` on `Iterator`
|
||||
--> $DIR/map_flatten_fixable.rs:21:47
|
||||
--> $DIR/map_flatten_fixable.rs:20:47
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(|x| x.checked_add(1))`
|
||||
|
||||
error: called `map(..).flatten()` on `Iterator`
|
||||
--> $DIR/map_flatten_fixable.rs:24:47
|
||||
--> $DIR/map_flatten_fixable.rs:23:47
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|x| 0..x)`
|
||||
|
||||
error: called `map(..).flatten()` on `Option`
|
||||
--> $DIR/map_flatten_fixable.rs:27:40
|
||||
--> $DIR/map_flatten_fixable.rs:26:40
|
||||
|
|
||||
LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)`
|
||||
|
||||
error: called `map(..).flatten()` on `Result`
|
||||
--> $DIR/map_flatten_fixable.rs:30:42
|
||||
--> $DIR/map_flatten_fixable.rs:29:42
|
||||
|
|
||||
LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)`
|
||||
|
||||
error: called `map(..).flatten()` on `Iterator`
|
||||
--> $DIR/map_flatten_fixable.rs:39:10
|
||||
--> $DIR/map_flatten_fixable.rs:38:10
|
||||
|
|
||||
LL | .map(|n| match n {
|
||||
| __________^
|
||||
|
@ -72,7 +72,7 @@ LL ~ });
|
|||
|
|
||||
|
||||
error: called `map(..).flatten()` on `Option`
|
||||
--> $DIR/map_flatten_fixable.rs:59:10
|
||||
--> $DIR/map_flatten_fixable.rs:58:10
|
||||
|
|
||||
LL | .map(|_| {
|
||||
| __________^
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#![allow(clippy::disallowed_methods)]
|
||||
#![allow(clippy::disallowed_types)]
|
||||
#![allow(clippy::mixed_read_write_in_expression)]
|
||||
#![allow(for_loops_over_fallibles)]
|
||||
#![allow(clippy::useless_conversion)]
|
||||
#![allow(clippy::match_result_ok)]
|
||||
#![allow(clippy::overly_complex_bool_expr)]
|
||||
|
@ -27,9 +26,11 @@
|
|||
#![allow(clippy::recursive_format_impl)]
|
||||
#![allow(clippy::invisible_characters)]
|
||||
#![allow(drop_bounds)]
|
||||
#![allow(for_loops_over_fallibles)]
|
||||
#![allow(array_into_iter)]
|
||||
#![allow(invalid_atomic_ordering)]
|
||||
#![allow(invalid_value)]
|
||||
#![allow(let_underscore_drop)]
|
||||
#![allow(enum_intrinsics_non_enums)]
|
||||
#![allow(non_fmt_panics)]
|
||||
#![allow(named_arguments_used_positionally)]
|
||||
|
@ -45,8 +46,6 @@
|
|||
#![warn(clippy::disallowed_methods)]
|
||||
#![warn(clippy::disallowed_types)]
|
||||
#![warn(clippy::mixed_read_write_in_expression)]
|
||||
#![warn(for_loops_over_fallibles)]
|
||||
#![warn(for_loops_over_fallibles)]
|
||||
#![warn(clippy::useless_conversion)]
|
||||
#![warn(clippy::match_result_ok)]
|
||||
#![warn(clippy::overly_complex_bool_expr)]
|
||||
|
@ -66,9 +65,12 @@
|
|||
#![warn(clippy::invisible_characters)]
|
||||
#![warn(drop_bounds)]
|
||||
#![warn(for_loops_over_fallibles)]
|
||||
#![warn(for_loops_over_fallibles)]
|
||||
#![warn(for_loops_over_fallibles)]
|
||||
#![warn(array_into_iter)]
|
||||
#![warn(invalid_atomic_ordering)]
|
||||
#![warn(invalid_value)]
|
||||
#![warn(let_underscore_drop)]
|
||||
#![warn(enum_intrinsics_non_enums)]
|
||||
#![warn(non_fmt_panics)]
|
||||
#![warn(named_arguments_used_positionally)]
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#![allow(clippy::disallowed_methods)]
|
||||
#![allow(clippy::disallowed_types)]
|
||||
#![allow(clippy::mixed_read_write_in_expression)]
|
||||
#![allow(for_loops_over_fallibles)]
|
||||
#![allow(clippy::useless_conversion)]
|
||||
#![allow(clippy::match_result_ok)]
|
||||
#![allow(clippy::overly_complex_bool_expr)]
|
||||
|
@ -27,9 +26,11 @@
|
|||
#![allow(clippy::recursive_format_impl)]
|
||||
#![allow(clippy::invisible_characters)]
|
||||
#![allow(drop_bounds)]
|
||||
#![allow(for_loops_over_fallibles)]
|
||||
#![allow(array_into_iter)]
|
||||
#![allow(invalid_atomic_ordering)]
|
||||
#![allow(invalid_value)]
|
||||
#![allow(let_underscore_drop)]
|
||||
#![allow(enum_intrinsics_non_enums)]
|
||||
#![allow(non_fmt_panics)]
|
||||
#![allow(named_arguments_used_positionally)]
|
||||
|
@ -45,8 +46,6 @@
|
|||
#![warn(clippy::disallowed_method)]
|
||||
#![warn(clippy::disallowed_type)]
|
||||
#![warn(clippy::eval_order_dependence)]
|
||||
#![warn(clippy::for_loop_over_option)]
|
||||
#![warn(clippy::for_loop_over_result)]
|
||||
#![warn(clippy::identity_conversion)]
|
||||
#![warn(clippy::if_let_some_result)]
|
||||
#![warn(clippy::logic_bug)]
|
||||
|
@ -65,10 +64,13 @@
|
|||
#![warn(clippy::to_string_in_display)]
|
||||
#![warn(clippy::zero_width_space)]
|
||||
#![warn(clippy::drop_bounds)]
|
||||
#![warn(clippy::for_loop_over_option)]
|
||||
#![warn(clippy::for_loop_over_result)]
|
||||
#![warn(clippy::for_loops_over_fallibles)]
|
||||
#![warn(clippy::into_iter_on_array)]
|
||||
#![warn(clippy::invalid_atomic_ordering)]
|
||||
#![warn(clippy::invalid_ref)]
|
||||
#![warn(clippy::let_underscore_drop)]
|
||||
#![warn(clippy::mem_discriminant_non_enum)]
|
||||
#![warn(clippy::panic_params)]
|
||||
#![warn(clippy::positional_named_format_parameters)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: lint `clippy::blacklisted_name` has been renamed to `clippy::disallowed_names`
|
||||
--> $DIR/rename.rs:39:9
|
||||
--> $DIR/rename.rs:40:9
|
||||
|
|
||||
LL | #![warn(clippy::blacklisted_name)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_names`
|
||||
|
@ -7,232 +7,238 @@ LL | #![warn(clippy::blacklisted_name)]
|
|||
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
|
||||
|
||||
error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_if_conditions`
|
||||
--> $DIR/rename.rs:40:9
|
||||
--> $DIR/rename.rs:41:9
|
||||
|
|
||||
LL | #![warn(clippy::block_in_if_condition_expr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
|
||||
|
||||
error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_if_conditions`
|
||||
--> $DIR/rename.rs:41:9
|
||||
--> $DIR/rename.rs:42:9
|
||||
|
|
||||
LL | #![warn(clippy::block_in_if_condition_stmt)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
|
||||
|
||||
error: lint `clippy::box_vec` has been renamed to `clippy::box_collection`
|
||||
--> $DIR/rename.rs:42:9
|
||||
--> $DIR/rename.rs:43:9
|
||||
|
|
||||
LL | #![warn(clippy::box_vec)]
|
||||
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection`
|
||||
|
||||
error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes`
|
||||
--> $DIR/rename.rs:43:9
|
||||
--> $DIR/rename.rs:44:9
|
||||
|
|
||||
LL | #![warn(clippy::const_static_lifetime)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes`
|
||||
|
||||
error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity`
|
||||
--> $DIR/rename.rs:44:9
|
||||
--> $DIR/rename.rs:45:9
|
||||
|
|
||||
LL | #![warn(clippy::cyclomatic_complexity)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity`
|
||||
|
||||
error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods`
|
||||
--> $DIR/rename.rs:45:9
|
||||
--> $DIR/rename.rs:46:9
|
||||
|
|
||||
LL | #![warn(clippy::disallowed_method)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods`
|
||||
|
||||
error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types`
|
||||
--> $DIR/rename.rs:46:9
|
||||
--> $DIR/rename.rs:47:9
|
||||
|
|
||||
LL | #![warn(clippy::disallowed_type)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types`
|
||||
|
||||
error: lint `clippy::eval_order_dependence` has been renamed to `clippy::mixed_read_write_in_expression`
|
||||
--> $DIR/rename.rs:47:9
|
||||
--> $DIR/rename.rs:48:9
|
||||
|
|
||||
LL | #![warn(clippy::eval_order_dependence)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::mixed_read_write_in_expression`
|
||||
|
||||
error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles`
|
||||
--> $DIR/rename.rs:48:9
|
||||
|
|
||||
LL | #![warn(clippy::for_loop_over_option)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||
|
||||
error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles`
|
||||
--> $DIR/rename.rs:49:9
|
||||
|
|
||||
LL | #![warn(clippy::for_loop_over_result)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||
|
||||
error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion`
|
||||
--> $DIR/rename.rs:50:9
|
||||
--> $DIR/rename.rs:49:9
|
||||
|
|
||||
LL | #![warn(clippy::identity_conversion)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion`
|
||||
|
||||
error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok`
|
||||
--> $DIR/rename.rs:51:9
|
||||
--> $DIR/rename.rs:50:9
|
||||
|
|
||||
LL | #![warn(clippy::if_let_some_result)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok`
|
||||
|
||||
error: lint `clippy::logic_bug` has been renamed to `clippy::overly_complex_bool_expr`
|
||||
--> $DIR/rename.rs:52:9
|
||||
--> $DIR/rename.rs:51:9
|
||||
|
|
||||
LL | #![warn(clippy::logic_bug)]
|
||||
| ^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::overly_complex_bool_expr`
|
||||
|
||||
error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default`
|
||||
--> $DIR/rename.rs:53:9
|
||||
--> $DIR/rename.rs:52:9
|
||||
|
|
||||
LL | #![warn(clippy::new_without_default_derive)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default`
|
||||
|
||||
error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map`
|
||||
--> $DIR/rename.rs:54:9
|
||||
--> $DIR/rename.rs:53:9
|
||||
|
|
||||
LL | #![warn(clippy::option_and_then_some)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map`
|
||||
|
||||
error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used`
|
||||
--> $DIR/rename.rs:55:9
|
||||
--> $DIR/rename.rs:54:9
|
||||
|
|
||||
LL | #![warn(clippy::option_expect_used)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
|
||||
|
||||
error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or`
|
||||
--> $DIR/rename.rs:56:9
|
||||
--> $DIR/rename.rs:55:9
|
||||
|
|
||||
LL | #![warn(clippy::option_map_unwrap_or)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
||||
|
||||
error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
|
||||
--> $DIR/rename.rs:57:9
|
||||
--> $DIR/rename.rs:56:9
|
||||
|
|
||||
LL | #![warn(clippy::option_map_unwrap_or_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
||||
|
||||
error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used`
|
||||
--> $DIR/rename.rs:58:9
|
||||
--> $DIR/rename.rs:57:9
|
||||
|
|
||||
LL | #![warn(clippy::option_unwrap_used)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
|
||||
|
||||
error: lint `clippy::ref_in_deref` has been renamed to `clippy::needless_borrow`
|
||||
--> $DIR/rename.rs:59:9
|
||||
--> $DIR/rename.rs:58:9
|
||||
|
|
||||
LL | #![warn(clippy::ref_in_deref)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::needless_borrow`
|
||||
|
||||
error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used`
|
||||
--> $DIR/rename.rs:60:9
|
||||
--> $DIR/rename.rs:59:9
|
||||
|
|
||||
LL | #![warn(clippy::result_expect_used)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
|
||||
|
||||
error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
|
||||
--> $DIR/rename.rs:61:9
|
||||
--> $DIR/rename.rs:60:9
|
||||
|
|
||||
LL | #![warn(clippy::result_map_unwrap_or_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
||||
|
||||
error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used`
|
||||
--> $DIR/rename.rs:62:9
|
||||
--> $DIR/rename.rs:61:9
|
||||
|
|
||||
LL | #![warn(clippy::result_unwrap_used)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
|
||||
|
||||
error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str`
|
||||
--> $DIR/rename.rs:63:9
|
||||
--> $DIR/rename.rs:62:9
|
||||
|
|
||||
LL | #![warn(clippy::single_char_push_str)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str`
|
||||
|
||||
error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions`
|
||||
--> $DIR/rename.rs:64:9
|
||||
--> $DIR/rename.rs:63:9
|
||||
|
|
||||
LL | #![warn(clippy::stutter)]
|
||||
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions`
|
||||
|
||||
error: lint `clippy::to_string_in_display` has been renamed to `clippy::recursive_format_impl`
|
||||
--> $DIR/rename.rs:65:9
|
||||
--> $DIR/rename.rs:64:9
|
||||
|
|
||||
LL | #![warn(clippy::to_string_in_display)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::recursive_format_impl`
|
||||
|
||||
error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters`
|
||||
--> $DIR/rename.rs:66:9
|
||||
--> $DIR/rename.rs:65:9
|
||||
|
|
||||
LL | #![warn(clippy::zero_width_space)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters`
|
||||
|
||||
error: lint `clippy::drop_bounds` has been renamed to `drop_bounds`
|
||||
--> $DIR/rename.rs:67:9
|
||||
--> $DIR/rename.rs:66:9
|
||||
|
|
||||
LL | #![warn(clippy::drop_bounds)]
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds`
|
||||
|
||||
error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles`
|
||||
error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles`
|
||||
--> $DIR/rename.rs:67:9
|
||||
|
|
||||
LL | #![warn(clippy::for_loop_over_option)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||
|
||||
error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles`
|
||||
--> $DIR/rename.rs:68:9
|
||||
|
|
||||
LL | #![warn(clippy::for_loop_over_result)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||
|
||||
error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles`
|
||||
--> $DIR/rename.rs:69:9
|
||||
|
|
||||
LL | #![warn(clippy::for_loops_over_fallibles)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||
|
||||
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
|
||||
--> $DIR/rename.rs:69:9
|
||||
--> $DIR/rename.rs:70:9
|
||||
|
|
||||
LL | #![warn(clippy::into_iter_on_array)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter`
|
||||
|
||||
error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering`
|
||||
--> $DIR/rename.rs:70:9
|
||||
--> $DIR/rename.rs:71:9
|
||||
|
|
||||
LL | #![warn(clippy::invalid_atomic_ordering)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering`
|
||||
|
||||
error: lint `clippy::invalid_ref` has been renamed to `invalid_value`
|
||||
--> $DIR/rename.rs:71:9
|
||||
--> $DIR/rename.rs:72:9
|
||||
|
|
||||
LL | #![warn(clippy::invalid_ref)]
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value`
|
||||
|
||||
error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
|
||||
--> $DIR/rename.rs:73:9
|
||||
|
|
||||
LL | #![warn(clippy::let_underscore_drop)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
|
||||
|
||||
error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums`
|
||||
--> $DIR/rename.rs:72:9
|
||||
--> $DIR/rename.rs:74:9
|
||||
|
|
||||
LL | #![warn(clippy::mem_discriminant_non_enum)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums`
|
||||
|
||||
error: lint `clippy::panic_params` has been renamed to `non_fmt_panics`
|
||||
--> $DIR/rename.rs:73:9
|
||||
--> $DIR/rename.rs:75:9
|
||||
|
|
||||
LL | #![warn(clippy::panic_params)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics`
|
||||
|
||||
error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally`
|
||||
--> $DIR/rename.rs:74:9
|
||||
--> $DIR/rename.rs:76:9
|
||||
|
|
||||
LL | #![warn(clippy::positional_named_format_parameters)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally`
|
||||
|
||||
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr`
|
||||
--> $DIR/rename.rs:75:9
|
||||
--> $DIR/rename.rs:77:9
|
||||
|
|
||||
LL | #![warn(clippy::temporary_cstring_as_ptr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr`
|
||||
|
||||
error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
|
||||
--> $DIR/rename.rs:76:9
|
||||
--> $DIR/rename.rs:78:9
|
||||
|
|
||||
LL | #![warn(clippy::unknown_clippy_lints)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
|
||||
|
||||
error: lint `clippy::unused_label` has been renamed to `unused_labels`
|
||||
--> $DIR/rename.rs:77:9
|
||||
--> $DIR/rename.rs:79:9
|
||||
|
|
||||
LL | #![warn(clippy::unused_label)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels`
|
||||
|
||||
error: aborting due to 39 previous errors
|
||||
error: aborting due to 40 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue