mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
Change lint to be pedantic
This commit is contained in:
parent
e64b27525b
commit
e23a424b31
@ -685,6 +685,7 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Con
|
||||
types::LINKEDLIST,
|
||||
unicode::NON_ASCII_LITERAL,
|
||||
unicode::UNICODE_NOT_NFC,
|
||||
unused_self::UNUSED_SELF,
|
||||
use_self::USE_SELF,
|
||||
]);
|
||||
|
||||
@ -928,7 +929,6 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Con
|
||||
unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
|
||||
unused_io_amount::UNUSED_IO_AMOUNT,
|
||||
unused_label::UNUSED_LABEL,
|
||||
unused_self::UNUSED_SELF,
|
||||
unwrap::PANICKING_UNWRAP,
|
||||
unwrap::UNNECESSARY_UNWRAP,
|
||||
vec::USELESS_VEC,
|
||||
@ -1107,7 +1107,6 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Con
|
||||
types::UNNECESSARY_CAST,
|
||||
types::VEC_BOX,
|
||||
unused_label::UNUSED_LABEL,
|
||||
unused_self::UNUSED_SELF,
|
||||
unwrap::UNNECESSARY_UNWRAP,
|
||||
zero_div_zero::ZERO_DIVIDED_BY_ZERO,
|
||||
]);
|
||||
|
@ -32,7 +32,7 @@ declare_clippy_lint! {
|
||||
/// }
|
||||
/// ```
|
||||
pub UNUSED_SELF,
|
||||
complexity,
|
||||
pedantic,
|
||||
"methods that contain a `self` argument but don't use it"
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
|
||||
let body = cx.tcx.hir().body(*body_id);
|
||||
let self_param = &body.params[0];
|
||||
let self_hir_id = self_param.pat.hir_id;
|
||||
let visitor = &mut UnusedSelfVisitor {
|
||||
let mut visitor = UnusedSelfVisitor {
|
||||
cx,
|
||||
uses_self: false,
|
||||
self_hir_id: &self_hir_id,
|
||||
|
@ -2088,7 +2088,7 @@ pub const ALL_LINTS: [Lint; 325] = [
|
||||
},
|
||||
Lint {
|
||||
name: "unused_self",
|
||||
group: "complexity",
|
||||
group: "pedantic",
|
||||
desc: "methods that contain a `self` argument but don\'t use it",
|
||||
deprecation: None,
|
||||
module: "unused_self",
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![warn(clippy::nonminimal_bool, clippy::logic_bug)]
|
||||
#![allow(clippy::unused_self)]
|
||||
|
||||
#[allow(unused, clippy::many_single_char_names)]
|
||||
fn main() {
|
||||
|
@ -1,18 +1,18 @@
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:11:13
|
||||
--> $DIR/booleans.rs:10:13
|
||||
|
|
||||
LL | let _ = a && b || a;
|
||||
| ^^^^^^^^^^^ help: it would look like the following: `a`
|
||||
|
|
||||
= note: `-D clippy::logic-bug` implied by `-D warnings`
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:11:18
|
||||
--> $DIR/booleans.rs:10:18
|
||||
|
|
||||
LL | let _ = a && b || a;
|
||||
| ^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:13:13
|
||||
--> $DIR/booleans.rs:12:13
|
||||
|
|
||||
LL | let _ = !true;
|
||||
| ^^^^^ help: try: `false`
|
||||
@ -20,55 +20,55 @@ LL | let _ = !true;
|
||||
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:14:13
|
||||
--> $DIR/booleans.rs:13:13
|
||||
|
|
||||
LL | let _ = !false;
|
||||
| ^^^^^^ help: try: `true`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:15:13
|
||||
--> $DIR/booleans.rs:14:13
|
||||
|
|
||||
LL | let _ = !!a;
|
||||
| ^^^ help: try: `a`
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:16:13
|
||||
--> $DIR/booleans.rs:15:13
|
||||
|
|
||||
LL | let _ = false && a;
|
||||
| ^^^^^^^^^^ help: it would look like the following: `false`
|
||||
|
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:16:22
|
||||
--> $DIR/booleans.rs:15:22
|
||||
|
|
||||
LL | let _ = false && a;
|
||||
| ^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:17:13
|
||||
--> $DIR/booleans.rs:16:13
|
||||
|
|
||||
LL | let _ = false || a;
|
||||
| ^^^^^^^^^^ help: try: `a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:22:13
|
||||
--> $DIR/booleans.rs:21:13
|
||||
|
|
||||
LL | let _ = !(!a && b);
|
||||
| ^^^^^^^^^^ help: try: `!b || a`
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:32:13
|
||||
--> $DIR/booleans.rs:31:13
|
||||
|
|
||||
LL | let _ = a == b && a != b;
|
||||
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
||||
|
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:32:13
|
||||
--> $DIR/booleans.rs:31:13
|
||||
|
|
||||
LL | let _ = a == b && a != b;
|
||||
| ^^^^^^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:33:13
|
||||
--> $DIR/booleans.rs:32:13
|
||||
|
|
||||
LL | let _ = a == b && c == 5 && a == b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -80,7 +80,7 @@ LL | let _ = !(c != 5 || a != b);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:34:13
|
||||
--> $DIR/booleans.rs:33:13
|
||||
|
|
||||
LL | let _ = a == b && c == 5 && b == a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -92,31 +92,31 @@ LL | let _ = !(c != 5 || a != b);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:35:13
|
||||
--> $DIR/booleans.rs:34:13
|
||||
|
|
||||
LL | let _ = a < b && a >= b;
|
||||
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
||||
|
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:35:13
|
||||
--> $DIR/booleans.rs:34:13
|
||||
|
|
||||
LL | let _ = a < b && a >= b;
|
||||
| ^^^^^
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> $DIR/booleans.rs:36:13
|
||||
--> $DIR/booleans.rs:35:13
|
||||
|
|
||||
LL | let _ = a > b && a <= b;
|
||||
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
||||
|
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> $DIR/booleans.rs:36:13
|
||||
--> $DIR/booleans.rs:35:13
|
||||
|
|
||||
LL | let _ = a > b && a <= b;
|
||||
| ^^^^^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:38:13
|
||||
--> $DIR/booleans.rs:37:13
|
||||
|
|
||||
LL | let _ = a != b || !(a != b || c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -128,73 +128,73 @@ LL | let _ = !(a == b && c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:46:13
|
||||
--> $DIR/booleans.rs:45:13
|
||||
|
|
||||
LL | let _ = !a.is_some();
|
||||
| ^^^^^^^^^^^^ help: try: `a.is_none()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:48:13
|
||||
--> $DIR/booleans.rs:47:13
|
||||
|
|
||||
LL | let _ = !a.is_none();
|
||||
| ^^^^^^^^^^^^ help: try: `a.is_some()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:50:13
|
||||
--> $DIR/booleans.rs:49:13
|
||||
|
|
||||
LL | let _ = !b.is_err();
|
||||
| ^^^^^^^^^^^ help: try: `b.is_ok()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:52:13
|
||||
--> $DIR/booleans.rs:51:13
|
||||
|
|
||||
LL | let _ = !b.is_ok();
|
||||
| ^^^^^^^^^^ help: try: `b.is_err()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:54:13
|
||||
--> $DIR/booleans.rs:53:13
|
||||
|
|
||||
LL | let _ = !(a.is_some() && !c);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:55:26
|
||||
--> $DIR/booleans.rs:54:26
|
||||
|
|
||||
LL | let _ = !(!c ^ c) || !a.is_some();
|
||||
| ^^^^^^^^^^^^ help: try: `a.is_none()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:56:25
|
||||
--> $DIR/booleans.rs:55:25
|
||||
|
|
||||
LL | let _ = (!c ^ c) || !a.is_some();
|
||||
| ^^^^^^^^^^^^ help: try: `a.is_none()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:57:23
|
||||
--> $DIR/booleans.rs:56:23
|
||||
|
|
||||
LL | let _ = !c ^ c || !a.is_some();
|
||||
| ^^^^^^^^^^^^ help: try: `a.is_none()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:129:8
|
||||
--> $DIR/booleans.rs:128:8
|
||||
|
|
||||
LL | if !res.is_ok() {}
|
||||
| ^^^^^^^^^^^^ help: try: `res.is_err()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:130:8
|
||||
--> $DIR/booleans.rs:129:8
|
||||
|
|
||||
LL | if !res.is_err() {}
|
||||
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:133:8
|
||||
--> $DIR/booleans.rs:132:8
|
||||
|
|
||||
LL | if !res.is_some() {}
|
||||
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/booleans.rs:134:8
|
||||
--> $DIR/booleans.rs:133:8
|
||||
|
|
||||
LL | if !res.is_none() {}
|
||||
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::all)]
|
||||
#![allow(unused, clippy::needless_pass_by_value, clippy::vec_box, clippy::unused_self)]
|
||||
#![allow(unused, clippy::needless_pass_by_value, clippy::vec_box)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
|
||||
|
@ -22,7 +22,6 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
||||
pub struct A;
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
impl A {
|
||||
pub fn as_ref(self) -> &'static str {
|
||||
"A"
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name
|
||||
--> $DIR/def_id_nocore.rs:27:19
|
||||
--> $DIR/def_id_nocore.rs:26:19
|
||||
|
|
||||
LL | pub fn as_ref(self) -> &'static str {
|
||||
| ^^^^
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(never_type)]
|
||||
#![warn(clippy::diverging_sub_expression)]
|
||||
#![allow(clippy::match_same_arms, clippy::logic_bug, clippy::unused_self)]
|
||||
#![allow(clippy::match_same_arms, clippy::logic_bug)]
|
||||
|
||||
#[allow(clippy::empty_loop)]
|
||||
fn diverge() -> ! {
|
||||
|
@ -7,8 +7,7 @@
|
||||
clippy::many_single_char_names,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
clippy::unused_self
|
||||
clippy::trivially_copy_pass_by_ref
|
||||
)]
|
||||
#![warn(
|
||||
clippy::redundant_closure,
|
||||
|
@ -7,8 +7,7 @@
|
||||
clippy::many_single_char_names,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
clippy::unused_self
|
||||
clippy::trivially_copy_pass_by_ref
|
||||
)]
|
||||
#![warn(
|
||||
clippy::redundant_closure,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:22:27
|
||||
--> $DIR/eta.rs:21:27
|
||||
|
|
||||
LL | let a = Some(1u8).map(|a| foo(a));
|
||||
| ^^^^^^^^^^ help: remove closure as shown: `foo`
|
||||
@ -7,13 +7,13 @@ LL | let a = Some(1u8).map(|a| foo(a));
|
||||
= note: `-D clippy::redundant-closure` implied by `-D warnings`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:23:10
|
||||
--> $DIR/eta.rs:22:10
|
||||
|
|
||||
LL | meta(|a| foo(a));
|
||||
| ^^^^^^^^^^ help: remove closure as shown: `foo`
|
||||
|
||||
error: this expression borrows a reference that is immediately dereferenced by the compiler
|
||||
--> $DIR/eta.rs:26:21
|
||||
--> $DIR/eta.rs:25:21
|
||||
|
|
||||
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
||||
| ^^^ help: change this to: `&2`
|
||||
@ -21,13 +21,13 @@ LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
||||
= note: `-D clippy::needless-borrow` implied by `-D warnings`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:33:27
|
||||
--> $DIR/eta.rs:32:27
|
||||
|
|
||||
LL | let e = Some(1u8).map(|a| generic(a));
|
||||
| ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:76:51
|
||||
--> $DIR/eta.rs:75:51
|
||||
|
|
||||
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
|
||||
| ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
|
||||
@ -35,43 +35,43 @@ LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
|
||||
= note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:78:51
|
||||
--> $DIR/eta.rs:77:51
|
||||
|
|
||||
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
|
||||
| ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:81:42
|
||||
--> $DIR/eta.rs:80:42
|
||||
|
|
||||
LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
|
||||
| ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:86:29
|
||||
--> $DIR/eta.rs:85:29
|
||||
|
|
||||
LL | let e = Some("str").map(|s| s.to_string());
|
||||
| ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:88:27
|
||||
--> $DIR/eta.rs:87:27
|
||||
|
|
||||
LL | let e = Some('a').map(|s| s.to_uppercase());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:91:65
|
||||
--> $DIR/eta.rs:90:65
|
||||
|
|
||||
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:174:27
|
||||
--> $DIR/eta.rs:173:27
|
||||
|
|
||||
LL | let a = Some(1u8).map(|a| foo_ptr(a));
|
||||
| ^^^^^^^^^^^^^^ help: remove closure as shown: `foo_ptr`
|
||||
|
||||
error: redundant closure found
|
||||
--> $DIR/eta.rs:179:27
|
||||
--> $DIR/eta.rs:178:27
|
||||
|
|
||||
LL | let a = Some(1u8).map(|a| closure(a));
|
||||
| ^^^^^^^^^^^^^^ help: remove closure as shown: `closure`
|
||||
|
@ -1,6 +1,5 @@
|
||||
// run-rustfix
|
||||
|
||||
#![allow(clippy::unused_self)]
|
||||
#![warn(clippy::expect_fun_call)]
|
||||
|
||||
/// Checks implementation of the `EXPECT_FUN_CALL` lint
|
||||
|
@ -1,6 +1,5 @@
|
||||
// run-rustfix
|
||||
|
||||
#![allow(clippy::unused_self)]
|
||||
#![warn(clippy::expect_fun_call)]
|
||||
|
||||
/// Checks implementation of the `EXPECT_FUN_CALL` lint
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:29:26
|
||||
--> $DIR/expect_fun_call.rs:28:26
|
||||
|
|
||||
LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
||||
@ -7,61 +7,61 @@ LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code
|
||||
= note: `-D clippy::expect-fun-call` implied by `-D warnings`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:32:26
|
||||
--> $DIR/expect_fun_call.rs:31:26
|
||||
|
|
||||
LL | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:42:25
|
||||
--> $DIR/expect_fun_call.rs:41:25
|
||||
|
|
||||
LL | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:45:25
|
||||
--> $DIR/expect_fun_call.rs:44:25
|
||||
|
|
||||
LL | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:57:17
|
||||
--> $DIR/expect_fun_call.rs:56:17
|
||||
|
|
||||
LL | Some("foo").expect(format!("{} {}", 1, 2).as_ref());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{} {}", 1, 2))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:78:21
|
||||
--> $DIR/expect_fun_call.rs:77:21
|
||||
|
|
||||
LL | Some("foo").expect(&get_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!(get_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:79:21
|
||||
--> $DIR/expect_fun_call.rs:78:21
|
||||
|
|
||||
LL | Some("foo").expect(get_string().as_ref());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!(get_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:80:21
|
||||
--> $DIR/expect_fun_call.rs:79:21
|
||||
|
|
||||
LL | Some("foo").expect(get_string().as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!(get_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:82:21
|
||||
--> $DIR/expect_fun_call.rs:81:21
|
||||
|
|
||||
LL | Some("foo").expect(get_static_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!(get_static_str()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:83:21
|
||||
--> $DIR/expect_fun_call.rs:82:21
|
||||
|
|
||||
LL | Some("foo").expect(get_non_static_str(&0));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!(get_non_static_str(&0).to_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:87:16
|
||||
--> $DIR/expect_fun_call.rs:86:16
|
||||
|
|
||||
LL | Some(true).expect(&format!("key {}, {}", 1, 2));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("key {}, {}", 1, 2))`
|
||||
|
@ -3,8 +3,7 @@
|
||||
dead_code,
|
||||
clippy::needless_lifetimes,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
clippy::unused_self
|
||||
clippy::trivially_copy_pass_by_ref
|
||||
)]
|
||||
#![warn(clippy::extra_unused_lifetimes)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:15:14
|
||||
--> $DIR/extra_unused_lifetimes.rs:14:14
|
||||
|
|
||||
LL | fn unused_lt<'a>(x: u8) {}
|
||||
| ^^
|
||||
@ -7,19 +7,19 @@ LL | fn unused_lt<'a>(x: u8) {}
|
||||
= note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings`
|
||||
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:17:25
|
||||
--> $DIR/extra_unused_lifetimes.rs:16:25
|
||||
|
|
||||
LL | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
|
||||
| ^^
|
||||
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:42:10
|
||||
--> $DIR/extra_unused_lifetimes.rs:41:10
|
||||
|
|
||||
LL | fn x<'a>(&self) {}
|
||||
| ^^
|
||||
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:68:22
|
||||
--> $DIR/extra_unused_lifetimes.rs:67:22
|
||||
|
|
||||
LL | fn unused_lt<'a>(x: u8) {}
|
||||
| ^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this function has too many arguments (8/7)
|
||||
--> $DIR/functions.rs:7:1
|
||||
--> $DIR/functions.rs:8:1
|
||||
|
|
||||
LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -7,7 +7,7 @@ LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f
|
||||
= note: `-D clippy::too-many-arguments` implied by `-D warnings`
|
||||
|
||||
error: this function has too many arguments (8/7)
|
||||
--> $DIR/functions.rs:10:1
|
||||
--> $DIR/functions.rs:11:1
|
||||
|
|
||||
LL | / fn bad_multiline(
|
||||
LL | | one: u32,
|
||||
@ -19,19 +19,19 @@ LL | | ) {
|
||||
| |__^
|
||||
|
||||
error: this function has too many arguments (8/7)
|
||||
--> $DIR/functions.rs:44:5
|
||||
--> $DIR/functions.rs:45:5
|
||||
|
|
||||
LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this function has too many arguments (8/7)
|
||||
--> $DIR/functions.rs:53:5
|
||||
--> $DIR/functions.rs:54:5
|
||||
|
|
||||
LL | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:62:34
|
||||
--> $DIR/functions.rs:63:34
|
||||
|
|
||||
LL | println!("{}", unsafe { *p });
|
||||
| ^
|
||||
@ -39,49 +39,49 @@ LL | println!("{}", unsafe { *p });
|
||||
= note: `-D clippy::not-unsafe-ptr-arg-deref` implied by `-D warnings`
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:63:35
|
||||
--> $DIR/functions.rs:64:35
|
||||
|
|
||||
LL | println!("{:?}", unsafe { p.as_ref() });
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:64:33
|
||||
--> $DIR/functions.rs:65:33
|
||||
|
|
||||
LL | unsafe { std::ptr::read(p) };
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:75:30
|
||||
--> $DIR/functions.rs:76:30
|
||||
|
|
||||
LL | println!("{}", unsafe { *p });
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:76:31
|
||||
--> $DIR/functions.rs:77:31
|
||||
|
|
||||
LL | println!("{:?}", unsafe { p.as_ref() });
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:77:29
|
||||
--> $DIR/functions.rs:78:29
|
||||
|
|
||||
LL | unsafe { std::ptr::read(p) };
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:86:34
|
||||
--> $DIR/functions.rs:87:34
|
||||
|
|
||||
LL | println!("{}", unsafe { *p });
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:87:35
|
||||
--> $DIR/functions.rs:88:35
|
||||
|
|
||||
LL | println!("{:?}", unsafe { p.as_ref() });
|
||||
| ^
|
||||
|
||||
error: this public function dereferences a raw pointer but is not marked `unsafe`
|
||||
--> $DIR/functions.rs:88:33
|
||||
--> $DIR/functions.rs:89:33
|
||||
|
|
||||
LL | unsafe { std::ptr::read(p) };
|
||||
| ^
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![warn(clippy::inherent_to_string)]
|
||||
#![deny(clippy::inherent_to_string_shadow_display)]
|
||||
#![allow(clippy::many_single_char_names, clippy::unused_self)]
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
|
||||
use std::fmt;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
// aux-build:option_helpers.rs
|
||||
|
||||
#![allow(clippy::unused_self)]
|
||||
#![warn(clippy::iter_nth)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:34:23
|
||||
--> $DIR/iter_nth.rs:33:23
|
||||
|
|
||||
LL | let bad_vec = some_vec.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -7,37 +7,37 @@ LL | let bad_vec = some_vec.iter().nth(3);
|
||||
= note: `-D clippy::iter-nth` implied by `-D warnings`
|
||||
|
||||
error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:35:26
|
||||
--> $DIR/iter_nth.rs:34:26
|
||||
|
|
||||
LL | let bad_slice = &some_vec[..].iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:36:31
|
||||
--> $DIR/iter_nth.rs:35:31
|
||||
|
|
||||
LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:37:29
|
||||
--> $DIR/iter_nth.rs:36:29
|
||||
|
|
||||
LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:42:23
|
||||
--> $DIR/iter_nth.rs:41:23
|
||||
|
|
||||
LL | let bad_vec = some_vec.iter_mut().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:45:26
|
||||
--> $DIR/iter_nth.rs:44:26
|
||||
|
|
||||
LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
|
||||
--> $DIR/iter_nth.rs:48:29
|
||||
--> $DIR/iter_nth.rs:47:29
|
||||
|
|
||||
LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::len_without_is_empty)]
|
||||
#![allow(dead_code, unused, clippy::unused_self)]
|
||||
#![allow(dead_code, unused)]
|
||||
|
||||
pub struct PubOne;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
|
||||
#![warn(clippy::len_zero)]
|
||||
#![allow(dead_code, unused, clippy::len_without_is_empty, clippy::unused_self)]
|
||||
#![allow(dead_code, unused, clippy::len_without_is_empty)]
|
||||
|
||||
pub struct One;
|
||||
struct Wither;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
|
||||
#![warn(clippy::len_zero)]
|
||||
#![allow(dead_code, unused, clippy::len_without_is_empty, clippy::unused_self)]
|
||||
#![allow(dead_code, unused, clippy::len_without_is_empty)]
|
||||
|
||||
pub struct One;
|
||||
struct Wither;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(unused, clippy::unused_self)]
|
||||
#![allow(unused)]
|
||||
struct Mappable {}
|
||||
|
||||
impl Mappable {
|
||||
|
@ -14,6 +14,7 @@
|
||||
clippy::use_self,
|
||||
clippy::useless_format,
|
||||
clippy::wrong_self_convention,
|
||||
clippy::unused_self,
|
||||
unused
|
||||
)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name
|
||||
--> $DIR/methods.rs:37:5
|
||||
--> $DIR/methods.rs:38:5
|
||||
|
|
||||
LL | / pub fn add(self, other: T) -> T {
|
||||
LL | | self
|
||||
@ -9,7 +9,7 @@ LL | | }
|
||||
= note: `-D clippy::should-implement-trait` implied by `-D warnings`
|
||||
|
||||
error: methods called `new` usually return `Self`
|
||||
--> $DIR/methods.rs:153:5
|
||||
--> $DIR/methods.rs:154:5
|
||||
|
|
||||
LL | / fn new() -> i32 {
|
||||
LL | | 0
|
||||
@ -19,7 +19,7 @@ LL | | }
|
||||
= note: `-D clippy::new-ret-no-self` implied by `-D warnings`
|
||||
|
||||
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
|
||||
--> $DIR/methods.rs:175:13
|
||||
--> $DIR/methods.rs:176:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| x + 1)
|
||||
| _____________^
|
||||
@ -31,7 +31,7 @@ LL | | .unwrap_or(0);
|
||||
= note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
|
||||
|
||||
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
|
||||
--> $DIR/methods.rs:179:13
|
||||
--> $DIR/methods.rs:180:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| {
|
||||
| _____________^
|
||||
@ -41,7 +41,7 @@ LL | | ).unwrap_or(0);
|
||||
| |____________________________^
|
||||
|
||||
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
|
||||
--> $DIR/methods.rs:183:13
|
||||
--> $DIR/methods.rs:184:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| x + 1)
|
||||
| _____________^
|
||||
@ -51,7 +51,7 @@ LL | | });
|
||||
| |__________________^
|
||||
|
||||
error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
|
||||
--> $DIR/methods.rs:188:13
|
||||
--> $DIR/methods.rs:189:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -59,7 +59,7 @@ LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
|
||||
= note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
|
||||
|
||||
error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
|
||||
--> $DIR/methods.rs:190:13
|
||||
--> $DIR/methods.rs:191:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| {
|
||||
| _____________^
|
||||
@ -69,7 +69,7 @@ LL | | ).unwrap_or(None);
|
||||
| |_____________________^
|
||||
|
||||
error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
|
||||
--> $DIR/methods.rs:194:13
|
||||
--> $DIR/methods.rs:195:13
|
||||
|
|
||||
LL | let _ = opt
|
||||
| _____________^
|
||||
@ -80,7 +80,7 @@ LL | | .unwrap_or(None);
|
||||
= note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
|
||||
|
||||
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
|
||||
--> $DIR/methods.rs:205:13
|
||||
--> $DIR/methods.rs:206:13
|
||||
|
|
||||
LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -88,7 +88,7 @@ LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
|
||||
= note: replace `map(|p| format!("{}.", p)).unwrap_or(id)` with `map_or(id, |p| format!("{}.", p))`
|
||||
|
||||
error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
|
||||
--> $DIR/methods.rs:209:13
|
||||
--> $DIR/methods.rs:210:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| x + 1)
|
||||
| _____________^
|
||||
@ -100,7 +100,7 @@ LL | | .unwrap_or_else(|| 0);
|
||||
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
|
||||
|
||||
error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
|
||||
--> $DIR/methods.rs:213:13
|
||||
--> $DIR/methods.rs:214:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| {
|
||||
| _____________^
|
||||
@ -110,7 +110,7 @@ LL | | ).unwrap_or_else(|| 0);
|
||||
| |____________________________________^
|
||||
|
||||
error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
|
||||
--> $DIR/methods.rs:217:13
|
||||
--> $DIR/methods.rs:218:13
|
||||
|
|
||||
LL | let _ = opt.map(|x| x + 1)
|
||||
| _____________^
|
||||
@ -120,7 +120,7 @@ LL | | );
|
||||
| |_________________^
|
||||
|
||||
error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
|
||||
--> $DIR/methods.rs:247:13
|
||||
--> $DIR/methods.rs:248:13
|
||||
|
|
||||
LL | let _ = v.iter().filter(|&x| *x < 0).next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -129,7 +129,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next();
|
||||
= note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
|
||||
|
||||
error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
|
||||
--> $DIR/methods.rs:250:13
|
||||
--> $DIR/methods.rs:251:13
|
||||
|
|
||||
LL | let _ = v.iter().filter(|&x| {
|
||||
| _____________^
|
||||
@ -139,7 +139,7 @@ LL | | ).next();
|
||||
| |___________________________^
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:267:22
|
||||
--> $DIR/methods.rs:268:22
|
||||
|
|
||||
LL | let _ = v.iter().find(|&x| *x < 0).is_some();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| *x < 0)`
|
||||
@ -147,25 +147,25 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some();
|
||||
= note: `-D clippy::search-is-some` implied by `-D warnings`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:268:20
|
||||
--> $DIR/methods.rs:269:20
|
||||
|
|
||||
LL | let _ = (0..1).find(|x| **y == *x).is_some(); // one dereference less
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| **y == x)`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:269:20
|
||||
--> $DIR/methods.rs:270:20
|
||||
|
|
||||
LL | let _ = (0..1).find(|x| *x == 0).is_some();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| x == 0)`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:270:22
|
||||
--> $DIR/methods.rs:271:22
|
||||
|
|
||||
LL | let _ = v.iter().find(|x| **x == 0).is_some();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| *x == 0)`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:273:13
|
||||
--> $DIR/methods.rs:274:13
|
||||
|
|
||||
LL | let _ = v.iter().find(|&x| {
|
||||
| _____________^
|
||||
@ -175,13 +175,13 @@ LL | | ).is_some();
|
||||
| |______________________________^
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:279:22
|
||||
--> $DIR/methods.rs:280:22
|
||||
|
|
||||
LL | let _ = v.iter().position(|&x| x < 0).is_some();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|&x| x < 0)`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:282:13
|
||||
--> $DIR/methods.rs:283:13
|
||||
|
|
||||
LL | let _ = v.iter().position(|&x| {
|
||||
| _____________^
|
||||
@ -191,13 +191,13 @@ LL | | ).is_some();
|
||||
| |______________________________^
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:288:22
|
||||
--> $DIR/methods.rs:289:22
|
||||
|
|
||||
LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|&x| x < 0)`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
|
||||
--> $DIR/methods.rs:291:13
|
||||
--> $DIR/methods.rs:292:13
|
||||
|
|
||||
LL | let _ = v.iter().rposition(|&x| {
|
||||
| _____________^
|
||||
@ -207,7 +207,7 @@ LL | | ).is_some();
|
||||
| |______________________________^
|
||||
|
||||
error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message
|
||||
--> $DIR/methods.rs:306:13
|
||||
--> $DIR/methods.rs:307:13
|
||||
|
|
||||
LL | let _ = opt.unwrap();
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -2,7 +2,6 @@
|
||||
//! compilation error.
|
||||
//! The .stderr output of this test should be empty. Otherwise it's a bug somewhere.
|
||||
|
||||
#![allow(clippy::unused_self)]
|
||||
#![warn(clippy::missing_const_for_fn)]
|
||||
#![feature(start)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::missing_const_for_fn)]
|
||||
#![allow(clippy::let_and_return, clippy::unused_self)]
|
||||
#![allow(clippy::let_and_return)]
|
||||
|
||||
use std::mem::transmute;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(unused, clippy::trivially_copy_pass_by_ref, clippy::unused_self)]
|
||||
#![allow(unused, clippy::trivially_copy_pass_by_ref)]
|
||||
#![warn(clippy::mut_from_ref)]
|
||||
|
||||
struct Foo;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(unused_variables, clippy::trivially_copy_pass_by_ref, clippy::unused_self)]
|
||||
#![allow(unused_variables, clippy::trivially_copy_pass_by_ref)]
|
||||
|
||||
fn takes_an_immutable_reference(a: &i32) {}
|
||||
fn takes_a_mutable_reference(a: &mut i32) {}
|
||||
|
@ -1,10 +1,5 @@
|
||||
#![warn(clippy::needless_lifetimes)]
|
||||
#![allow(
|
||||
dead_code,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
clippy::unused_self
|
||||
)]
|
||||
#![allow(dead_code, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)]
|
||||
|
||||
fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:9:1
|
||||
--> $DIR/needless_lifetimes.rs:4:1
|
||||
|
|
||||
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -7,13 +7,13 @@ LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
|
||||
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:11:1
|
||||
--> $DIR/needless_lifetimes.rs:6:1
|
||||
|
|
||||
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:21:1
|
||||
--> $DIR/needless_lifetimes.rs:16:1
|
||||
|
|
||||
LL | / fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
|
||||
LL | | x
|
||||
@ -21,7 +21,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:50:1
|
||||
--> $DIR/needless_lifetimes.rs:45:1
|
||||
|
|
||||
LL | / fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {
|
||||
LL | | Ok(x)
|
||||
@ -29,7 +29,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:55:1
|
||||
--> $DIR/needless_lifetimes.rs:50:1
|
||||
|
|
||||
LL | / fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>
|
||||
LL | | where
|
||||
@ -40,13 +40,13 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:67:1
|
||||
--> $DIR/needless_lifetimes.rs:62:1
|
||||
|
|
||||
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:91:1
|
||||
--> $DIR/needless_lifetimes.rs:86:1
|
||||
|
|
||||
LL | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
|
||||
LL | | where
|
||||
@ -57,7 +57,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:125:5
|
||||
--> $DIR/needless_lifetimes.rs:120:5
|
||||
|
|
||||
LL | / fn self_and_out<'s>(&'s self) -> &'s u8 {
|
||||
LL | | &self.x
|
||||
@ -65,13 +65,13 @@ LL | | }
|
||||
| |_____^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:134:5
|
||||
--> $DIR/needless_lifetimes.rs:129:5
|
||||
|
|
||||
LL | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:153:1
|
||||
--> $DIR/needless_lifetimes.rs:148:1
|
||||
|
|
||||
LL | / fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
|
||||
LL | | unimplemented!()
|
||||
@ -79,7 +79,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:183:1
|
||||
--> $DIR/needless_lifetimes.rs:178:1
|
||||
|
|
||||
LL | / fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str {
|
||||
LL | | unimplemented!()
|
||||
@ -87,7 +87,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:189:1
|
||||
--> $DIR/needless_lifetimes.rs:184:1
|
||||
|
|
||||
LL | / fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
|
||||
LL | | unimplemented!()
|
||||
@ -95,7 +95,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:208:1
|
||||
--> $DIR/needless_lifetimes.rs:203:1
|
||||
|
|
||||
LL | / fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
|
||||
LL | | unimplemented!()
|
||||
@ -103,7 +103,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:216:1
|
||||
--> $DIR/needless_lifetimes.rs:211:1
|
||||
|
|
||||
LL | / fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {
|
||||
LL | | unimplemented!()
|
||||
@ -111,7 +111,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:252:1
|
||||
--> $DIR/needless_lifetimes.rs:247:1
|
||||
|
|
||||
LL | / fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
|
||||
LL | | unimplemented!()
|
||||
@ -119,13 +119,13 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:259:9
|
||||
--> $DIR/needless_lifetimes.rs:254:9
|
||||
|
|
||||
LL | fn needless_lt<'a>(x: &'a u8) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:263:9
|
||||
--> $DIR/needless_lifetimes.rs:258:9
|
||||
|
|
||||
LL | fn needless_lt<'a>(_x: &'a u8) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
|
||||
#![warn(clippy::option_map_unit_fn)]
|
||||
#![allow(unused, clippy::unused_self)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn do_nothing<T>(_: T) {}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
|
||||
#![warn(clippy::option_map_unit_fn)]
|
||||
#![allow(unused, clippy::unused_self)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn do_nothing<T>(_: T) {}
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
struct NotARange;
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
impl NotARange {
|
||||
fn step_by(&self, _: u32) {}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
--> $DIR/range.rs:10:13
|
||||
--> $DIR/range.rs:8:13
|
||||
|
|
||||
LL | let _ = (0..1).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -7,25 +7,25 @@ LL | let _ = (0..1).step_by(0);
|
||||
= note: `-D clippy::iterator-step-by-zero` implied by `-D warnings`
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
--> $DIR/range.rs:14:13
|
||||
--> $DIR/range.rs:12:13
|
||||
|
|
||||
LL | let _ = (1..).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
--> $DIR/range.rs:15:13
|
||||
--> $DIR/range.rs:13:13
|
||||
|
|
||||
LL | let _ = (1..=2).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
--> $DIR/range.rs:18:13
|
||||
--> $DIR/range.rs:16:13
|
||||
|
|
||||
LL | let _ = x.step_by(0);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: It is more idiomatic to use v1.iter().enumerate()
|
||||
--> $DIR/range.rs:26:14
|
||||
--> $DIR/range.rs:24:14
|
||||
|
|
||||
LL | let _x = v1.iter().zip(0..v1.len());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ LL | let _x = v1.iter().zip(0..v1.len());
|
||||
= note: `-D clippy::range-zip-with-len` implied by `-D warnings`
|
||||
|
||||
error: Iterator::step_by(0) will panic at runtime
|
||||
--> $DIR/range.rs:30:13
|
||||
--> $DIR/range.rs:28:13
|
||||
|
|
||||
LL | let _ = v1.iter().step_by(2 / 3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#![feature(never_type)]
|
||||
#![warn(clippy::result_map_unit_fn)]
|
||||
#![allow(unused, clippy::unused_self)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn do_nothing<T>(_: T) {}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#![feature(never_type)]
|
||||
#![warn(clippy::result_map_unit_fn)]
|
||||
#![allow(unused, clippy::unused_self)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn do_nothing<T>(_: T) {}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
#[derive(Copy, Clone)]
|
||||
struct HasChars;
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
impl HasChars {
|
||||
fn chars(self) -> std::str::Chars<'static> {
|
||||
"HasChars".chars()
|
||||
|
@ -3,7 +3,6 @@
|
||||
#[derive(Copy, Clone)]
|
||||
struct HasChars;
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
impl HasChars {
|
||||
fn chars(self) -> std::str::Chars<'static> {
|
||||
"HasChars".chars()
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: calling `.extend(_.chars())`
|
||||
--> $DIR/string_extend.rs:19:5
|
||||
--> $DIR/string_extend.rs:18:5
|
||||
|
|
||||
LL | s.extend(abc.chars());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)`
|
||||
@ -7,13 +7,13 @@ LL | s.extend(abc.chars());
|
||||
= note: `-D clippy::string-extend-chars` implied by `-D warnings`
|
||||
|
||||
error: calling `.extend(_.chars())`
|
||||
--> $DIR/string_extend.rs:22:5
|
||||
--> $DIR/string_extend.rs:21:5
|
||||
|
|
||||
LL | s.extend("abc".chars());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str("abc")`
|
||||
|
||||
error: calling `.extend(_.chars())`
|
||||
--> $DIR/string_extend.rs:25:5
|
||||
--> $DIR/string_extend.rs:24:5
|
||||
|
|
||||
LL | s.extend(def.chars());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&def)`
|
||||
|
@ -4,8 +4,7 @@
|
||||
#![allow(
|
||||
clippy::many_single_char_names,
|
||||
clippy::blacklisted_name,
|
||||
clippy::redundant_field_names,
|
||||
clippy::unused_self
|
||||
clippy::redundant_field_names
|
||||
)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:51:11
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:50:11
|
||||
|
|
||||
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `u32`
|
||||
@ -7,85 +7,85 @@ LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
||||
= note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:51:20
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:50:20
|
||||
|
|
||||
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Foo`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:51:29
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:50:29
|
||||
|
|
||||
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Baz`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:58:12
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:57:12
|
||||
|
|
||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^^ help: consider passing by value instead: `self`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:58:22
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:57:22
|
||||
|
|
||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `u32`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:58:31
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:57:31
|
||||
|
|
||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Foo`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:58:40
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:57:40
|
||||
|
|
||||
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Baz`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:60:16
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:16
|
||||
|
|
||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `u32`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:60:25
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:25
|
||||
|
|
||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Foo`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:60:34
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:59:34
|
||||
|
|
||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Baz`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:72:16
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:71:16
|
||||
|
|
||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `u32`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:72:25
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:71:25
|
||||
|
|
||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Foo`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:72:34
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:71:34
|
||||
|
|
||||
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
|
||||
| ^^^^ help: consider passing by value instead: `Baz`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:76:34
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:75:34
|
||||
|
|
||||
LL | fn trait_method(&self, _foo: &Foo);
|
||||
| ^^^^ help: consider passing by value instead: `Foo`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:80:37
|
||||
--> $DIR/trivially_copy_pass_by_ref.rs:79:37
|
||||
|
|
||||
LL | fn trait_method2(&self, _color: &Color);
|
||||
| ^^^^^^ help: consider passing by value instead: `Color`
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-rustfix
|
||||
#![warn(clippy::unit_arg)]
|
||||
#![allow(clippy::no_effect, clippy::unused_self, unused_must_use)]
|
||||
#![allow(clippy::no_effect, unused_must_use)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-rustfix
|
||||
#![warn(clippy::unit_arg)]
|
||||
#![allow(clippy::no_effect, clippy::unused_self, unused_must_use)]
|
||||
#![allow(clippy::no_effect, unused_must_use)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
@ -102,6 +102,10 @@ mod not_applicable {
|
||||
impl A {
|
||||
fn method(x: u8, y: u8) {}
|
||||
}
|
||||
|
||||
trait B {
|
||||
fn method(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#![rustfmt::skip]
|
||||
|
||||
#![deny(clippy::unused_unit)]
|
||||
#![allow(dead_code, clippy::unused_self)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct Unitter;
|
||||
impl Unitter {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#![rustfmt::skip]
|
||||
|
||||
#![deny(clippy::unused_unit)]
|
||||
#![allow(dead_code, clippy::unused_self)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct Unitter;
|
||||
impl Unitter {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![warn(clippy::wrong_self_convention)]
|
||||
#![warn(clippy::wrong_pub_self_convention)]
|
||||
#![allow(dead_code, clippy::trivially_copy_pass_by_ref, clippy::unused_self)]
|
||||
#![allow(dead_code, clippy::trivially_copy_pass_by_ref)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user