Allow this lint on lint tests

This commit is contained in:
Hirochika Matsumoto 2020-10-18 17:55:25 +09:00
parent c7692cf749
commit 30632fb8e6
39 changed files with 173 additions and 149 deletions

View file

@ -1,4 +1,5 @@
#![warn(clippy::derive_ord_xor_partial_ord)]
#![allow(clippy::unnecessary_wrap)]
use std::cmp::Ordering;

View file

@ -1,12 +1,12 @@
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
--> $DIR/derive_ord_xor_partial_ord.rs:20:10
--> $DIR/derive_ord_xor_partial_ord.rs:21:10
|
LL | #[derive(Ord, PartialEq, Eq)]
| ^^^
|
= note: `-D clippy::derive-ord-xor-partial-ord` implied by `-D warnings`
note: `PartialOrd` implemented here
--> $DIR/derive_ord_xor_partial_ord.rs:23:1
--> $DIR/derive_ord_xor_partial_ord.rs:24:1
|
LL | / impl PartialOrd for DeriveOrd {
LL | | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@ -17,13 +17,13 @@ LL | | }
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
--> $DIR/derive_ord_xor_partial_ord.rs:29:10
--> $DIR/derive_ord_xor_partial_ord.rs:30:10
|
LL | #[derive(Ord, PartialEq, Eq)]
| ^^^
|
note: `PartialOrd` implemented here
--> $DIR/derive_ord_xor_partial_ord.rs:32:1
--> $DIR/derive_ord_xor_partial_ord.rs:33:1
|
LL | / impl PartialOrd<DeriveOrdWithExplicitTypeVariable> for DeriveOrdWithExplicitTypeVariable {
LL | | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@ -34,7 +34,7 @@ LL | | }
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are implementing `Ord` explicitly but have derived `PartialOrd`
--> $DIR/derive_ord_xor_partial_ord.rs:41:1
--> $DIR/derive_ord_xor_partial_ord.rs:42:1
|
LL | / impl std::cmp::Ord for DerivePartialOrd {
LL | | fn cmp(&self, other: &Self) -> Ordering {
@ -44,14 +44,14 @@ LL | | }
| |_^
|
note: `PartialOrd` implemented here
--> $DIR/derive_ord_xor_partial_ord.rs:38:10
--> $DIR/derive_ord_xor_partial_ord.rs:39:10
|
LL | #[derive(PartialOrd, PartialEq, Eq)]
| ^^^^^^^^^^
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are implementing `Ord` explicitly but have derived `PartialOrd`
--> $DIR/derive_ord_xor_partial_ord.rs:61:5
--> $DIR/derive_ord_xor_partial_ord.rs:62:5
|
LL | / impl Ord for DerivePartialOrdInUseOrd {
LL | | fn cmp(&self, other: &Self) -> Ordering {
@ -61,7 +61,7 @@ LL | | }
| |_____^
|
note: `PartialOrd` implemented here
--> $DIR/derive_ord_xor_partial_ord.rs:58:14
--> $DIR/derive_ord_xor_partial_ord.rs:59:14
|
LL | #[derive(PartialOrd, PartialEq, Eq)]
| ^^^^^^^^^^

View file

@ -1,6 +1,7 @@
// edition:2018
#![warn(clippy::missing_errors_doc)]
#![allow(clippy::result_unit_err)]
#![allow(clippy::unnecessary_wrap)]
use std::io;

View file

@ -1,6 +1,7 @@
#![warn(clippy::drop_ref)]
#![allow(clippy::toplevel_ref_arg)]
#![allow(clippy::map_err_ignore)]
#![allow(clippy::unnecessary_wrap)]
use std::mem::drop;

View file

@ -1,5 +1,6 @@
#![warn(clippy::forget_ref)]
#![allow(clippy::toplevel_ref_arg)]
#![allow(clippy::unnecessary_wrap)]
use std::mem::forget;

View file

@ -1,108 +1,108 @@
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:9:5
--> $DIR/forget_ref.rs:10:5
|
LL | forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::forget-ref` implied by `-D warnings`
note: argument has type `&SomeStruct`
--> $DIR/forget_ref.rs:9:12
--> $DIR/forget_ref.rs:10:12
|
LL | forget(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:12:5
--> $DIR/forget_ref.rs:13:5
|
LL | forget(&owned);
| ^^^^^^^^^^^^^^
|
note: argument has type `&SomeStruct`
--> $DIR/forget_ref.rs:12:12
--> $DIR/forget_ref.rs:13:12
|
LL | forget(&owned);
| ^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:13:5
--> $DIR/forget_ref.rs:14:5
|
LL | forget(&&owned);
| ^^^^^^^^^^^^^^^
|
note: argument has type `&&SomeStruct`
--> $DIR/forget_ref.rs:13:12
--> $DIR/forget_ref.rs:14:12
|
LL | forget(&&owned);
| ^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:14:5
--> $DIR/forget_ref.rs:15:5
|
LL | forget(&mut owned);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type `&mut SomeStruct`
--> $DIR/forget_ref.rs:14:12
--> $DIR/forget_ref.rs:15:12
|
LL | forget(&mut owned);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:18:5
--> $DIR/forget_ref.rs:19:5
|
LL | forget(&*reference1);
| ^^^^^^^^^^^^^^^^^^^^
|
note: argument has type `&SomeStruct`
--> $DIR/forget_ref.rs:18:12
--> $DIR/forget_ref.rs:19:12
|
LL | forget(&*reference1);
| ^^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:21:5
--> $DIR/forget_ref.rs:22:5
|
LL | forget(reference2);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type `&mut SomeStruct`
--> $DIR/forget_ref.rs:21:12
--> $DIR/forget_ref.rs:22:12
|
LL | forget(reference2);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:24:5
--> $DIR/forget_ref.rs:25:5
|
LL | forget(reference3);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type `&SomeStruct`
--> $DIR/forget_ref.rs:24:12
--> $DIR/forget_ref.rs:25:12
|
LL | forget(reference3);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:29:5
--> $DIR/forget_ref.rs:30:5
|
LL | forget(&val);
| ^^^^^^^^^^^^
|
note: argument has type `&T`
--> $DIR/forget_ref.rs:29:12
--> $DIR/forget_ref.rs:30:12
|
LL | forget(&val);
| ^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/forget_ref.rs:37:5
--> $DIR/forget_ref.rs:38:5
|
LL | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type `&SomeStruct`
--> $DIR/forget_ref.rs:37:22
--> $DIR/forget_ref.rs:38:22
|
LL | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^

View file

@ -1,4 +1,5 @@
#![warn(clippy::let_underscore_must_use)]
#![allow(clippy::unnecessary_wrap)]
// Debug implementations can fire this lint,
// so we shouldn't lint external macros

View file

@ -1,5 +1,5 @@
error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore_must_use.rs:66:5
--> $DIR/let_underscore_must_use.rs:67:5
|
LL | let _ = f();
| ^^^^^^^^^^^^
@ -8,7 +8,7 @@ LL | let _ = f();
= help: consider explicitly using function result
error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore_must_use.rs:67:5
--> $DIR/let_underscore_must_use.rs:68:5
|
LL | let _ = g();
| ^^^^^^^^^^^^
@ -16,7 +16,7 @@ LL | let _ = g();
= help: consider explicitly using expression value
error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore_must_use.rs:69:5
--> $DIR/let_underscore_must_use.rs:70:5
|
LL | let _ = l(0_u32);
| ^^^^^^^^^^^^^^^^^
@ -24,7 +24,7 @@ LL | let _ = l(0_u32);
= help: consider explicitly using function result
error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore_must_use.rs:73:5
--> $DIR/let_underscore_must_use.rs:74:5
|
LL | let _ = s.f();
| ^^^^^^^^^^^^^^
@ -32,7 +32,7 @@ LL | let _ = s.f();
= help: consider explicitly using function result
error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore_must_use.rs:74:5
--> $DIR/let_underscore_must_use.rs:75:5
|
LL | let _ = s.g();
| ^^^^^^^^^^^^^^
@ -40,7 +40,7 @@ LL | let _ = s.g();
= help: consider explicitly using expression value
error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore_must_use.rs:77:5
--> $DIR/let_underscore_must_use.rs:78:5
|
LL | let _ = S::h();
| ^^^^^^^^^^^^^^^
@ -48,7 +48,7 @@ LL | let _ = S::h();
= help: consider explicitly using function result
error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore_must_use.rs:78:5
--> $DIR/let_underscore_must_use.rs:79:5
|
LL | let _ = S::p();
| ^^^^^^^^^^^^^^^
@ -56,7 +56,7 @@ LL | let _ = S::p();
= help: consider explicitly using expression value
error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore_must_use.rs:80:5
--> $DIR/let_underscore_must_use.rs:81:5
|
LL | let _ = S::a();
| ^^^^^^^^^^^^^^^
@ -64,7 +64,7 @@ LL | let _ = S::a();
= help: consider explicitly using function result
error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore_must_use.rs:82:5
--> $DIR/let_underscore_must_use.rs:83:5
|
LL | let _ = if true { Ok(()) } else { Err(()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL | let _ = if true { Ok(()) } else { Err(()) };
= help: consider explicitly using expression value
error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore_must_use.rs:86:5
--> $DIR/let_underscore_must_use.rs:87:5
|
LL | let _ = a.is_ok();
| ^^^^^^^^^^^^^^^^^^
@ -80,7 +80,7 @@ LL | let _ = a.is_ok();
= help: consider explicitly using function result
error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore_must_use.rs:88:5
--> $DIR/let_underscore_must_use.rs:89:5
|
LL | let _ = a.map(|_| ());
| ^^^^^^^^^^^^^^^^^^^^^^
@ -88,7 +88,7 @@ LL | let _ = a.map(|_| ());
= help: consider explicitly using expression value
error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore_must_use.rs:90:5
--> $DIR/let_underscore_must_use.rs:91:5
|
LL | let _ = a;
| ^^^^^^^^^^

View file

@ -4,6 +4,7 @@
#![allow(clippy::let_underscore_drop)]
#![allow(clippy::missing_docs_in_private_items)]
#![allow(clippy::map_identity)]
#![allow(clippy::unnecessary_wrap)]
fn main() {
// mapping to Option on Iterator

View file

@ -4,6 +4,7 @@
#![allow(clippy::let_underscore_drop)]
#![allow(clippy::missing_docs_in_private_items)]
#![allow(clippy::map_identity)]
#![allow(clippy::unnecessary_wrap)]
fn main() {
// mapping to Option on Iterator

View file

@ -1,5 +1,5 @@
#![warn(clippy::needless_lifetimes)]
#![allow(dead_code, clippy::needless_pass_by_value)]
#![allow(dead_code, clippy::needless_pass_by_value, clippy::unnecessary_wrap)]
fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}

View file

@ -2,6 +2,7 @@
#![warn(clippy::option_map_unit_fn)]
#![allow(unused)]
#![allow(clippy::unnecessary_wrap)]
fn do_nothing<T>(_: T) {}

View file

@ -2,6 +2,7 @@
#![warn(clippy::option_map_unit_fn)]
#![allow(unused)]
#![allow(clippy::unnecessary_wrap)]
fn do_nothing<T>(_: T) {}

View file

@ -1,5 +1,5 @@
error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:38:5
--> $DIR/option_map_unit_fn_fixable.rs:39:5
|
LL | x.field.map(do_nothing);
| ^^^^^^^^^^^^^^^^^^^^^^^-
@ -9,7 +9,7 @@ LL | x.field.map(do_nothing);
= note: `-D clippy::option-map-unit-fn` implied by `-D warnings`
error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:40:5
--> $DIR/option_map_unit_fn_fixable.rs:41:5
|
LL | x.field.map(do_nothing);
| ^^^^^^^^^^^^^^^^^^^^^^^-
@ -17,7 +17,7 @@ LL | x.field.map(do_nothing);
| help: try this: `if let Some(x_field) = x.field { do_nothing(x_field) }`
error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:42:5
--> $DIR/option_map_unit_fn_fixable.rs:43:5
|
LL | x.field.map(diverge);
| ^^^^^^^^^^^^^^^^^^^^-
@ -25,7 +25,7 @@ LL | x.field.map(diverge);
| help: try this: `if let Some(x_field) = x.field { diverge(x_field) }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:48:5
--> $DIR/option_map_unit_fn_fixable.rs:49:5
|
LL | x.field.map(|value| x.do_option_nothing(value + captured));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -33,7 +33,7 @@ LL | x.field.map(|value| x.do_option_nothing(value + captured));
| help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:50:5
--> $DIR/option_map_unit_fn_fixable.rs:51:5
|
LL | x.field.map(|value| { x.do_option_plus_one(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -41,7 +41,7 @@ LL | x.field.map(|value| { x.do_option_plus_one(value + captured); });
| help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:53:5
--> $DIR/option_map_unit_fn_fixable.rs:54:5
|
LL | x.field.map(|value| do_nothing(value + captured));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -49,7 +49,7 @@ LL | x.field.map(|value| do_nothing(value + captured));
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:55:5
--> $DIR/option_map_unit_fn_fixable.rs:56:5
|
LL | x.field.map(|value| { do_nothing(value + captured) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -57,7 +57,7 @@ LL | x.field.map(|value| { do_nothing(value + captured) });
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:57:5
--> $DIR/option_map_unit_fn_fixable.rs:58:5
|
LL | x.field.map(|value| { do_nothing(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -65,7 +65,7 @@ LL | x.field.map(|value| { do_nothing(value + captured); });
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:59:5
--> $DIR/option_map_unit_fn_fixable.rs:60:5
|
LL | x.field.map(|value| { { do_nothing(value + captured); } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -73,7 +73,7 @@ LL | x.field.map(|value| { { do_nothing(value + captured); } });
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:62:5
--> $DIR/option_map_unit_fn_fixable.rs:63:5
|
LL | x.field.map(|value| diverge(value + captured));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -81,7 +81,7 @@ LL | x.field.map(|value| diverge(value + captured));
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:64:5
--> $DIR/option_map_unit_fn_fixable.rs:65:5
|
LL | x.field.map(|value| { diverge(value + captured) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -89,7 +89,7 @@ LL | x.field.map(|value| { diverge(value + captured) });
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:66:5
--> $DIR/option_map_unit_fn_fixable.rs:67:5
|
LL | x.field.map(|value| { diverge(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -97,7 +97,7 @@ LL | x.field.map(|value| { diverge(value + captured); });
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:68:5
--> $DIR/option_map_unit_fn_fixable.rs:69:5
|
LL | x.field.map(|value| { { diverge(value + captured); } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -105,7 +105,7 @@ LL | x.field.map(|value| { { diverge(value + captured); } });
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:73:5
--> $DIR/option_map_unit_fn_fixable.rs:74:5
|
LL | x.field.map(|value| { let y = plus_one(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -113,7 +113,7 @@ LL | x.field.map(|value| { let y = plus_one(value + captured); });
| help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:75:5
--> $DIR/option_map_unit_fn_fixable.rs:76:5
|
LL | x.field.map(|value| { plus_one(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -121,7 +121,7 @@ LL | x.field.map(|value| { plus_one(value + captured); });
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:77:5
--> $DIR/option_map_unit_fn_fixable.rs:78:5
|
LL | x.field.map(|value| { { plus_one(value + captured); } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -129,7 +129,7 @@ LL | x.field.map(|value| { { plus_one(value + captured); } });
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:80:5
--> $DIR/option_map_unit_fn_fixable.rs:81:5
|
LL | x.field.map(|ref value| { do_nothing(value + captured) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
@ -137,7 +137,7 @@ LL | x.field.map(|ref value| { do_nothing(value + captured) });
| help: try this: `if let Some(ref value) = x.field { do_nothing(value + captured) }`
error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
--> $DIR/option_map_unit_fn_fixable.rs:82:5
--> $DIR/option_map_unit_fn_fixable.rs:83:5
|
LL | option().map(do_nothing);}
| ^^^^^^^^^^^^^^^^^^^^^^^^-

View file

@ -1,4 +1,5 @@
#![deny(clippy::option_option)]
#![allow(clippy::unnecessary_wrap)]
fn input(_: Option<Option<u8>>) {}

View file

@ -1,5 +1,5 @@
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:3:13
--> $DIR/option_option.rs:4:13
|
LL | fn input(_: Option<Option<u8>>) {}
| ^^^^^^^^^^^^^^^^^^
@ -11,55 +11,55 @@ LL | #![deny(clippy::option_option)]
| ^^^^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:5:16
--> $DIR/option_option.rs:6:16
|
LL | fn output() -> Option<Option<u8>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:9:27
--> $DIR/option_option.rs:10:27
|
LL | fn output_nested() -> Vec<Option<Option<u8>>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:14:30
--> $DIR/option_option.rs:15:30
|
LL | fn output_nested_nested() -> Option<Option<Option<u8>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:19:8
--> $DIR/option_option.rs:20:8
|
LL | x: Option<Option<u8>>,
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:23:23
--> $DIR/option_option.rs:24:23
|
LL | fn struct_fn() -> Option<Option<u8>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:29:22
--> $DIR/option_option.rs:30:22
|
LL | fn trait_fn() -> Option<Option<u8>>;
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:33:11
--> $DIR/option_option.rs:34:11
|
LL | Tuple(Option<Option<u8>>),
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:34:17
--> $DIR/option_option.rs:35:17
|
LL | Struct { x: Option<Option<u8>> },
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:75:14
--> $DIR/option_option.rs:78:14
|
LL | foo: Option<Option<Cow<'a, str>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -2,6 +2,7 @@
#![warn(clippy::or_fun_call)]
#![allow(dead_code)]
#![allow(clippy::unnecessary_wrap)]
use std::collections::BTreeMap;
use std::collections::HashMap;

View file

@ -2,6 +2,7 @@
#![warn(clippy::or_fun_call)]
#![allow(dead_code)]
#![allow(clippy::unnecessary_wrap)]
use std::collections::BTreeMap;
use std::collections::HashMap;

View file

@ -1,5 +1,5 @@
error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:32:19
--> $DIR/or_fun_call.rs:33:19
|
LL | with_const_fn.unwrap_or(Duration::from_secs(5));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Duration::from_secs(5))`
@ -7,55 +7,55 @@ LL | with_const_fn.unwrap_or(Duration::from_secs(5));
= note: `-D clippy::or-fun-call` implied by `-D warnings`
error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:35:22
--> $DIR/or_fun_call.rs:36:22
|
LL | with_constructor.unwrap_or(make());
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
error: use of `unwrap_or` followed by a call to `new`
--> $DIR/or_fun_call.rs:38:5
--> $DIR/or_fun_call.rs:39:5
|
LL | with_new.unwrap_or(Vec::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:41:21
--> $DIR/or_fun_call.rs:42:21
|
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:44:14
--> $DIR/or_fun_call.rs:45:14
|
LL | with_err.unwrap_or(make());
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:47:19
--> $DIR/or_fun_call.rs:48:19
|
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
error: use of `unwrap_or` followed by a call to `default`
--> $DIR/or_fun_call.rs:50:5
--> $DIR/or_fun_call.rs:51:5
|
LL | with_default_trait.unwrap_or(Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
error: use of `unwrap_or` followed by a call to `default`
--> $DIR/or_fun_call.rs:53:5
--> $DIR/or_fun_call.rs:54:5
|
LL | with_default_type.unwrap_or(u64::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
error: use of `unwrap_or` followed by a call to `new`
--> $DIR/or_fun_call.rs:56:5
--> $DIR/or_fun_call.rs:57:5
|
LL | with_vec.unwrap_or(vec![]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_default()`
error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:59:21
--> $DIR/or_fun_call.rs:60:21
|
LL | without_default.unwrap_or(Foo::new());
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`

View file

@ -1,4 +1,5 @@
#![warn(clippy::panic_in_result_fn)]
#![allow(clippy::unnecessary_wrap)]
struct A;

View file

@ -1,5 +1,5 @@
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:6:5
--> $DIR/panic_in_result_fn.rs:7:5
|
LL | / fn result_with_panic() -> Result<bool, String> // should emit lint
LL | | {
@ -10,14 +10,14 @@ LL | | }
= note: `-D clippy::panic-in-result-fn` implied by `-D warnings`
= help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:8:9
--> $DIR/panic_in_result_fn.rs:9:9
|
LL | panic!("error");
| ^^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:11:5
--> $DIR/panic_in_result_fn.rs:12:5
|
LL | / fn result_with_unimplemented() -> Result<bool, String> // should emit lint
LL | | {
@ -27,14 +27,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:13:9
--> $DIR/panic_in_result_fn.rs:14:9
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:16:5
--> $DIR/panic_in_result_fn.rs:17:5
|
LL | / fn result_with_unreachable() -> Result<bool, String> // should emit lint
LL | | {
@ -44,14 +44,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:18:9
--> $DIR/panic_in_result_fn.rs:19:9
|
LL | unreachable!();
| ^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:21:5
--> $DIR/panic_in_result_fn.rs:22:5
|
LL | / fn result_with_todo() -> Result<bool, String> // should emit lint
LL | | {
@ -61,14 +61,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:23:9
--> $DIR/panic_in_result_fn.rs:24:9
|
LL | todo!("Finish this");
| ^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:52:1
--> $DIR/panic_in_result_fn.rs:53:1
|
LL | / fn function_result_with_panic() -> Result<bool, String> // should emit lint
LL | | {
@ -78,14 +78,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:54:5
--> $DIR/panic_in_result_fn.rs:55:5
|
LL | panic!("error");
| ^^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:67:1
--> $DIR/panic_in_result_fn.rs:68:1
|
LL | / fn main() -> Result<(), String> {
LL | | todo!("finish main method");
@ -95,7 +95,7 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:68:5
--> $DIR/panic_in_result_fn.rs:69:5
|
LL | todo!("finish main method");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,6 @@
// run-rustfix
#![allow(unreachable_code)]
#![allow(clippy::unnecessary_wrap)]
fn some_func(a: Option<u32>) -> Option<u32> {
a?;

View file

@ -1,5 +1,6 @@
// run-rustfix
#![allow(unreachable_code)]
#![allow(clippy::unnecessary_wrap)]
fn some_func(a: Option<u32>) -> Option<u32> {
if a.is_none() {

View file

@ -1,5 +1,5 @@
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:5:5
--> $DIR/question_mark.rs:6:5
|
LL | / if a.is_none() {
LL | | return None;
@ -9,7 +9,7 @@ LL | | }
= note: `-D clippy::question-mark` implied by `-D warnings`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:50:9
--> $DIR/question_mark.rs:51:9
|
LL | / if (self.opt).is_none() {
LL | | return None;
@ -17,7 +17,7 @@ LL | | }
| |_________^ help: replace it with: `(self.opt)?;`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:54:9
--> $DIR/question_mark.rs:55:9
|
LL | / if self.opt.is_none() {
LL | | return None
@ -25,7 +25,7 @@ LL | | }
| |_________^ help: replace it with: `self.opt?;`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:58:17
--> $DIR/question_mark.rs:59:17
|
LL | let _ = if self.opt.is_none() {
| _________________^
@ -36,7 +36,7 @@ LL | | };
| |_________^ help: replace it with: `Some(self.opt?)`
error: this if-let-else may be rewritten with the `?` operator
--> $DIR/question_mark.rs:64:17
--> $DIR/question_mark.rs:65:17
|
LL | let _ = if let Some(x) = self.opt {
| _________________^
@ -47,7 +47,7 @@ LL | | };
| |_________^ help: replace it with: `self.opt?`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:81:9
--> $DIR/question_mark.rs:82:9
|
LL | / if self.opt.is_none() {
LL | | return None;
@ -55,7 +55,7 @@ LL | | }
| |_________^ help: replace it with: `self.opt.as_ref()?;`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:89:9
--> $DIR/question_mark.rs:90:9
|
LL | / if self.opt.is_none() {
LL | | return None;
@ -63,7 +63,7 @@ LL | | }
| |_________^ help: replace it with: `self.opt.as_ref()?;`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:97:9
--> $DIR/question_mark.rs:98:9
|
LL | / if self.opt.is_none() {
LL | | return None;
@ -71,7 +71,7 @@ LL | | }
| |_________^ help: replace it with: `self.opt.as_ref()?;`
error: this if-let-else may be rewritten with the `?` operator
--> $DIR/question_mark.rs:104:26
--> $DIR/question_mark.rs:105:26
|
LL | let v: &Vec<_> = if let Some(ref v) = self.opt {
| __________________________^
@ -82,7 +82,7 @@ LL | | };
| |_________^ help: replace it with: `self.opt.as_ref()?`
error: this if-let-else may be rewritten with the `?` operator
--> $DIR/question_mark.rs:114:17
--> $DIR/question_mark.rs:115:17
|
LL | let v = if let Some(v) = self.opt {
| _________________^
@ -93,7 +93,7 @@ LL | | };
| |_________^ help: replace it with: `self.opt?`
error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:129:5
--> $DIR/question_mark.rs:130:5
|
LL | / if f().is_none() {
LL | | return None;

View file

@ -7,6 +7,7 @@
unused_must_use,
clippy::needless_bool,
clippy::match_like_matches_macro,
clippy::unnecessary_wrap,
deprecated
)]

View file

@ -7,6 +7,7 @@
unused_must_use,
clippy::needless_bool,
clippy::match_like_matches_macro,
clippy::unnecessary_wrap,
deprecated
)]

View file

@ -1,5 +1,5 @@
error: redundant pattern matching, consider using `is_ok()`
--> $DIR/redundant_pattern_matching.rs:15:12
--> $DIR/redundant_pattern_matching.rs:16:12
|
LL | if let Ok(_) = &result {}
| -------^^^^^---------- help: try this: `if result.is_ok()`
@ -7,13 +7,13 @@ LL | if let Ok(_) = &result {}
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
error: redundant pattern matching, consider using `is_ok()`
--> $DIR/redundant_pattern_matching.rs:17:12
--> $DIR/redundant_pattern_matching.rs:18:12
|
LL | if let Ok(_) = Ok::<i32, i32>(42) {}
| -------^^^^^--------------------- help: try this: `if Ok::<i32, i32>(42).is_ok()`
error: redundant pattern matching, consider using `is_err()`
--> $DIR/redundant_pattern_matching.rs:19:12
--> $DIR/redundant_pattern_matching.rs:20:12
|
LL | if let Err(_) = Err::<i32, i32>(42) {}
| -------^^^^^^---------------------- help: try this: `if Err::<i32, i32>(42).is_err()`

View file

@ -2,6 +2,7 @@
// aux-build:macro_rules.rs
#![deny(clippy::try_err)]
#![allow(clippy::unnecessary_wrap)]
#[macro_use]
extern crate macro_rules;

View file

@ -2,6 +2,7 @@
// aux-build:macro_rules.rs
#![deny(clippy::try_err)]
#![allow(clippy::unnecessary_wrap)]
#[macro_use]
extern crate macro_rules;

View file

@ -1,5 +1,5 @@
error: returning an `Err(_)` with the `?` operator
--> $DIR/try_err.rs:18:9
--> $DIR/try_err.rs:19:9
|
LL | Err(err)?;
| ^^^^^^^^^ help: try this: `return Err(err)`
@ -11,19 +11,19 @@ LL | #![deny(clippy::try_err)]
| ^^^^^^^^^^^^^^^
error: returning an `Err(_)` with the `?` operator
--> $DIR/try_err.rs:28:9
--> $DIR/try_err.rs:29:9
|
LL | Err(err)?;
| ^^^^^^^^^ help: try this: `return Err(err.into())`
error: returning an `Err(_)` with the `?` operator
--> $DIR/try_err.rs:48:17
--> $DIR/try_err.rs:49:17
|
LL | Err(err)?;
| ^^^^^^^^^ help: try this: `return Err(err)`
error: returning an `Err(_)` with the `?` operator
--> $DIR/try_err.rs:67:17
--> $DIR/try_err.rs:68:17
|
LL | Err(err)?;
| ^^^^^^^^^ help: try this: `return Err(err.into())`

View file

@ -4,6 +4,7 @@
unused_must_use,
unused_variables,
clippy::unused_unit,
clippy::unnecessary_wrap,
clippy::or_fun_call
)]

View file

@ -1,5 +1,5 @@
error: passing a unit value to a function
--> $DIR/unit_arg.rs:29:5
--> $DIR/unit_arg.rs:30:5
|
LL | / foo({
LL | | 1;
@ -20,7 +20,7 @@ LL | foo(());
|
error: passing a unit value to a function
--> $DIR/unit_arg.rs:32:5
--> $DIR/unit_arg.rs:33:5
|
LL | foo(foo(1));
| ^^^^^^^^^^^
@ -32,7 +32,7 @@ LL | foo(());
|
error: passing a unit value to a function
--> $DIR/unit_arg.rs:33:5
--> $DIR/unit_arg.rs:34:5
|
LL | / foo({
LL | | foo(1);
@ -54,7 +54,7 @@ LL | foo(());
|
error: passing a unit value to a function
--> $DIR/unit_arg.rs:38:5
--> $DIR/unit_arg.rs:39:5
|
LL | / b.bar({
LL | | 1;
@ -74,7 +74,7 @@ LL | b.bar(());
|
error: passing unit values to a function
--> $DIR/unit_arg.rs:41:5
--> $DIR/unit_arg.rs:42:5
|
LL | taking_multiple_units(foo(0), foo(1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -87,7 +87,7 @@ LL | taking_multiple_units((), ());
|
error: passing unit values to a function
--> $DIR/unit_arg.rs:42:5
--> $DIR/unit_arg.rs:43:5
|
LL | / taking_multiple_units(foo(0), {
LL | | foo(1);
@ -110,7 +110,7 @@ LL | taking_multiple_units((), ());
|
error: passing unit values to a function
--> $DIR/unit_arg.rs:46:5
--> $DIR/unit_arg.rs:47:5
|
LL | / taking_multiple_units(
LL | | {
@ -140,7 +140,7 @@ LL | foo(2);
...
error: passing a unit value to a function
--> $DIR/unit_arg.rs:57:13
--> $DIR/unit_arg.rs:58:13
|
LL | None.or(Some(foo(2)));
| ^^^^^^^^^^^^
@ -154,7 +154,7 @@ LL | });
|
error: passing a unit value to a function
--> $DIR/unit_arg.rs:60:5
--> $DIR/unit_arg.rs:61:5
|
LL | foo(foo(()))
| ^^^^^^^^^^^^
@ -166,7 +166,7 @@ LL | foo(())
|
error: passing a unit value to a function
--> $DIR/unit_arg.rs:93:5
--> $DIR/unit_arg.rs:94:5
|
LL | Some(foo(1))
| ^^^^^^^^^^^^

View file

@ -1,7 +1,7 @@
// does not test any rustfixable lints
#![warn(clippy::clone_on_ref_ptr)]
#![allow(unused, clippy::redundant_clone)]
#![allow(unused, clippy::redundant_clone, clippy::unnecessary_wrap)]
use std::cell::RefCell;
use std::rc::{self, Rc};

View file

@ -1,6 +1,7 @@
// run-rustfix
#![deny(clippy::useless_conversion)]
#![allow(clippy::unnecessary_wrap)]
fn test_generic<T: Copy>(val: T) -> T {
let _ = val;

View file

@ -1,6 +1,7 @@
// run-rustfix
#![deny(clippy::useless_conversion)]
#![allow(clippy::unnecessary_wrap)]
fn test_generic<T: Copy>(val: T) -> T {
let _ = T::from(val);

View file

@ -1,5 +1,5 @@
error: useless conversion to the same type: `T`
--> $DIR/useless_conversion.rs:6:13
--> $DIR/useless_conversion.rs:7:13
|
LL | let _ = T::from(val);
| ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
@ -11,61 +11,61 @@ LL | #![deny(clippy::useless_conversion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: useless conversion to the same type: `T`
--> $DIR/useless_conversion.rs:7:5
--> $DIR/useless_conversion.rs:8:5
|
LL | val.into()
| ^^^^^^^^^^ help: consider removing `.into()`: `val`
error: useless conversion to the same type: `i32`
--> $DIR/useless_conversion.rs:19:22
--> $DIR/useless_conversion.rs:20:22
|
LL | let _: i32 = 0i32.into();
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion.rs:60:21
--> $DIR/useless_conversion.rs:61:21
|
LL | let _: String = "foo".to_string().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion.rs:61:21
--> $DIR/useless_conversion.rs:62:21
|
LL | let _: String = From::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion.rs:62:13
--> $DIR/useless_conversion.rs:63:13
|
LL | let _ = String::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion.rs:63:13
--> $DIR/useless_conversion.rs:64:13
|
LL | let _ = String::from(format!("A: {:04}", 123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
error: useless conversion to the same type: `std::str::Lines`
--> $DIR/useless_conversion.rs:64:13
--> $DIR/useless_conversion.rs:65:13
|
LL | let _ = "".lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
--> $DIR/useless_conversion.rs:65:13
--> $DIR/useless_conversion.rs:66:13
|
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
error: useless conversion to the same type: `std::string::String`
--> $DIR/useless_conversion.rs:66:21
--> $DIR/useless_conversion.rs:67:21
|
LL | let _: String = format!("Hello {}", "world").into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
error: useless conversion to the same type: `i32`
--> $DIR/useless_conversion.rs:71:13
--> $DIR/useless_conversion.rs:72:13
|
LL | let _ = i32::from(a + b) * 3;
| ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`

View file

@ -4,6 +4,7 @@
#![warn(clippy::wildcard_imports)]
//#![allow(clippy::redundant_pub_crate)]
#![allow(unused)]
#![allow(clippy::unnecessary_wrap)]
#![warn(unused_imports)]
extern crate wildcard_imports_helper;

View file

@ -4,6 +4,7 @@
#![warn(clippy::wildcard_imports)]
//#![allow(clippy::redundant_pub_crate)]
#![allow(unused)]
#![allow(clippy::unnecessary_wrap)]
#![warn(unused_imports)]
extern crate wildcard_imports_helper;

View file

@ -1,5 +1,5 @@
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:11:5
--> $DIR/wildcard_imports.rs:12:5
|
LL | use crate::fn_mod::*;
| ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo`
@ -7,85 +7,85 @@ LL | use crate::fn_mod::*;
= note: `-D clippy::wildcard-imports` implied by `-D warnings`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:12:5
--> $DIR/wildcard_imports.rs:13:5
|
LL | use crate::mod_mod::*;
| ^^^^^^^^^^^^^^^^^ help: try: `crate::mod_mod::inner_mod`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:13:5
--> $DIR/wildcard_imports.rs:14:5
|
LL | use crate::multi_fn_mod::*;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::multi_fn_mod::{multi_bar, multi_foo, multi_inner_mod}`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:15:5
--> $DIR/wildcard_imports.rs:16:5
|
LL | use crate::struct_mod::*;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::struct_mod::{A, inner_struct_mod}`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:19:5
--> $DIR/wildcard_imports.rs:20:5
|
LL | use wildcard_imports_helper::inner::inner_for_self_import::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::inner::inner_for_self_import::inner_extern_bar`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:20:5
--> $DIR/wildcard_imports.rs:21:5
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:91:13
--> $DIR/wildcard_imports.rs:92:13
|
LL | use crate::fn_mod::*;
| ^^^^^^^^^^^^^^^^ help: try: `crate::fn_mod::foo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:97:75
--> $DIR/wildcard_imports.rs:98:75
|
LL | use wildcard_imports_helper::inner::inner_for_self_import::{self, *};
| ^ help: try: `inner_extern_foo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:98:13
--> $DIR/wildcard_imports.rs:99:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:109:20
--> $DIR/wildcard_imports.rs:110:20
|
LL | use self::{inner::*, inner2::*};
| ^^^^^^^^ help: try: `inner::inner_foo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:109:30
--> $DIR/wildcard_imports.rs:110:30
|
LL | use self::{inner::*, inner2::*};
| ^^^^^^^^^ help: try: `inner2::inner_bar`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:116:13
--> $DIR/wildcard_imports.rs:117:13
|
LL | use wildcard_imports_helper::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:145:9
--> $DIR/wildcard_imports.rs:146:9
|
LL | use crate::in_fn_test::*;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:154:9
--> $DIR/wildcard_imports.rs:155:9
|
LL | use crate:: in_fn_test:: * ;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:155:9
--> $DIR/wildcard_imports.rs:156:9
|
LL | use crate:: fn_mod::
| _________^
@ -93,31 +93,31 @@ LL | | *;
| |_________^ help: try: `crate:: fn_mod::foo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:166:13
--> $DIR/wildcard_imports.rs:167:13
|
LL | use super::*;
| ^^^^^^^^ help: try: `super::foofoo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:201:17
--> $DIR/wildcard_imports.rs:202:17
|
LL | use super::*;
| ^^^^^^^^ help: try: `super::insidefoo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:209:13
--> $DIR/wildcard_imports.rs:210:13
|
LL | use super_imports::*;
| ^^^^^^^^^^^^^^^^ help: try: `super_imports::foofoo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:218:17
--> $DIR/wildcard_imports.rs:219:17
|
LL | use super::super::*;
| ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo`
error: usage of wildcard import
--> $DIR/wildcard_imports.rs:227:13
--> $DIR/wildcard_imports.rs:228:13
|
LL | use super::super::super_imports::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo`