Auto merge of #7866 - rust-lang:edition-2021-tests, r=Manishearth

update most tests to 2021 edition

Some tests would no longer work at all, so I added `edition:2015` or `edition:2018` to them.

Notably 2021 panics are not yet detected correctly. Once ready, this closes #7842.

---

changelog: none
This commit is contained in:
bors 2021-11-01 15:18:57 +00:00
commit 7cd9bf5af3
109 changed files with 528 additions and 533 deletions

View file

@ -28,7 +28,7 @@ tempfile = { version = "3.2", optional = true }
[dev-dependencies]
cargo_metadata = "0.12"
compiletest_rs = { version = "0.7", features = ["tmp"] }
compiletest_rs = { version = "0.7.1", features = ["tmp"] }
tester = "0.9"
regex = "1.5"
# This is used by the `collect-metadata` alias.

View file

@ -104,7 +104,10 @@ fn extern_flags() -> String {
}
fn default_config() -> compiletest::Config {
let mut config = compiletest::Config::default();
let mut config = compiletest::Config {
edition: Some("2021".into()),
..compiletest::Config::default()
};
if let Ok(filters) = env::var("TESTNAME") {
config.filters = filters.split(',').map(std::string::ToString::to_string).collect();

View file

@ -1,5 +1,3 @@
// edition:2018
#![warn(clippy::too_many_lines)]
// This function should be considered one line.

View file

@ -1,5 +1,5 @@
error: this function has too many lines (2/1)
--> $DIR/test.rs:20:1
--> $DIR/test.rs:18:1
|
LL | / fn too_many_lines() {
LL | | println!("This is bad.");
@ -10,7 +10,7 @@ LL | | }
= note: `-D clippy::too-many-lines` implied by `-D warnings`
error: this function has too many lines (4/1)
--> $DIR/test.rs:26:1
--> $DIR/test.rs:24:1
|
LL | / async fn async_too_many_lines() {
LL | | println!("This is bad.");
@ -19,7 +19,7 @@ LL | | }
| |_^
error: this function has too many lines (4/1)
--> $DIR/test.rs:32:1
--> $DIR/test.rs:30:1
|
LL | / fn closure_too_many_lines() {
LL | | let _ = {
@ -30,7 +30,7 @@ LL | | }
| |_^
error: this function has too many lines (2/1)
--> $DIR/test.rs:54:1
--> $DIR/test.rs:52:1
|
LL | / fn comment_before_code() {
LL | | let _ = "test";

View file

@ -1,3 +1,4 @@
//FIXME: suggestions are wrongly expanded, this should be fixed along with #7843
#![allow(non_fmt_panics)]
macro_rules! assert_const {
@ -6,7 +7,6 @@ macro_rules! assert_const {
debug_assert!($len < 0);
};
}
fn main() {
assert!(true);
assert!(false);
@ -14,7 +14,7 @@ fn main() {
assert!(false, "false message");
let msg = "panic message";
assert!(false, msg.to_uppercase());
assert!(false, "{}", msg.to_uppercase());
const B: bool = true;
assert!(B);

View file

@ -26,22 +26,13 @@ LL | assert!(true, "true message");
= help: remove it
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false, "false message")` should probably be replaced
error: `assert!(false, $crate::const_format_args!($($t)+))` should probably be replaced
--> $DIR/assertions_on_constants.rs:14:5
|
LL | assert!(false, "false message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!("false message")` or `unreachable!("false message")`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false, msg.to_uppercase())` should probably be replaced
--> $DIR/assertions_on_constants.rs:17:5
|
LL | assert!(false, msg.to_uppercase());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!(msg.to_uppercase())` or `unreachable!(msg.to_uppercase())`
= help: use `panic!($crate::const_format_args!($($t)+))` or `unreachable!($crate::const_format_args!($($t)+))`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(true)` will be optimized out by the compiler
@ -62,13 +53,13 @@ LL | assert!(C);
= help: use `panic!()` or `unreachable!()`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `assert!(false, "C message")` should probably be replaced
error: `assert!(false, $crate::const_format_args!($($t)+))` should probably be replaced
--> $DIR/assertions_on_constants.rs:24:5
|
LL | assert!(C, "C message");
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!("C message")` or `unreachable!("C message")`
= help: use `panic!($crate::const_format_args!($($t)+))` or `unreachable!($crate::const_format_args!($($t)+))`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `debug_assert!(true)` will be optimized out by the compiler
@ -80,5 +71,5 @@ LL | debug_assert!(true);
= help: remove it
= note: this error originates in the macro `$crate::assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 9 previous errors
error: aborting due to 8 previous errors

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![feature(async_closure)]
#![warn(clippy::async_yields_async)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![feature(async_closure)]
#![warn(clippy::async_yields_async)]

View file

@ -1,5 +1,5 @@
error: an async construct yields a type which is itself awaitable
--> $DIR/async_yields_async.rs:40:9
--> $DIR/async_yields_async.rs:39:9
|
LL | let _h = async {
| ____________________-
@ -20,7 +20,7 @@ LL + }.await
|
error: an async construct yields a type which is itself awaitable
--> $DIR/async_yields_async.rs:45:9
--> $DIR/async_yields_async.rs:44:9
|
LL | let _i = async {
| ____________________-
@ -33,7 +33,7 @@ LL | | };
| |_____- outer async construct
error: an async construct yields a type which is itself awaitable
--> $DIR/async_yields_async.rs:51:9
--> $DIR/async_yields_async.rs:50:9
|
LL | let _j = async || {
| _______________________-
@ -53,7 +53,7 @@ LL + }.await
|
error: an async construct yields a type which is itself awaitable
--> $DIR/async_yields_async.rs:56:9
--> $DIR/async_yields_async.rs:55:9
|
LL | let _k = async || {
| _______________________-
@ -66,7 +66,7 @@ LL | | };
| |_____- outer async construct
error: an async construct yields a type which is itself awaitable
--> $DIR/async_yields_async.rs:58:23
--> $DIR/async_yields_async.rs:57:23
|
LL | let _l = async || CustomFutureType;
| ^^^^^^^^^^^^^^^^
@ -76,7 +76,7 @@ LL | let _l = async || CustomFutureType;
| help: consider awaiting this value: `CustomFutureType.await`
error: an async construct yields a type which is itself awaitable
--> $DIR/async_yields_async.rs:64:9
--> $DIR/async_yields_async.rs:63:9
|
LL | let _m = async || {
| _______________________-

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::await_holding_lock)]
use std::sync::Mutex;

View file

@ -1,12 +1,12 @@
error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:7:9
--> $DIR/await_holding_lock.rs:6:9
|
LL | let guard = x.lock().unwrap();
| ^^^^^
|
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
note: these are all the await points this lock is held through
--> $DIR/await_holding_lock.rs:7:5
--> $DIR/await_holding_lock.rs:6:5
|
LL | / let guard = x.lock().unwrap();
LL | | baz().await
@ -14,13 +14,13 @@ LL | | }
| |_^
error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:28:9
--> $DIR/await_holding_lock.rs:27:9
|
LL | let guard = x.lock().unwrap();
| ^^^^^
|
note: these are all the await points this lock is held through
--> $DIR/await_holding_lock.rs:28:5
--> $DIR/await_holding_lock.rs:27:5
|
LL | / let guard = x.lock().unwrap();
LL | |
@ -32,13 +32,13 @@ LL | | }
| |_^
error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:41:13
--> $DIR/await_holding_lock.rs:40:13
|
LL | let guard = x.lock().unwrap();
| ^^^^^
|
note: these are all the await points this lock is held through
--> $DIR/await_holding_lock.rs:41:9
--> $DIR/await_holding_lock.rs:40:9
|
LL | / let guard = x.lock().unwrap();
LL | | baz().await
@ -46,13 +46,13 @@ LL | | };
| |_____^
error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:53:13
--> $DIR/await_holding_lock.rs:52:13
|
LL | let guard = x.lock().unwrap();
| ^^^^^
|
note: these are all the await points this lock is held through
--> $DIR/await_holding_lock.rs:53:9
--> $DIR/await_holding_lock.rs:52:9
|
LL | / let guard = x.lock().unwrap();
LL | | baz().await

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::await_holding_refcell_ref)]
use std::cell::RefCell;

View file

@ -1,12 +1,12 @@
error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:7:9
--> $DIR/await_holding_refcell_ref.rs:6:9
|
LL | let b = x.borrow();
| ^
|
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
note: these are all the await points this ref is held through
--> $DIR/await_holding_refcell_ref.rs:7:5
--> $DIR/await_holding_refcell_ref.rs:6:5
|
LL | / let b = x.borrow();
LL | | baz().await
@ -14,13 +14,13 @@ LL | | }
| |_^
error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:12:9
--> $DIR/await_holding_refcell_ref.rs:11:9
|
LL | let b = x.borrow_mut();
| ^
|
note: these are all the await points this ref is held through
--> $DIR/await_holding_refcell_ref.rs:12:5
--> $DIR/await_holding_refcell_ref.rs:11:5
|
LL | / let b = x.borrow_mut();
LL | | baz().await
@ -28,13 +28,13 @@ LL | | }
| |_^
error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:33:9
--> $DIR/await_holding_refcell_ref.rs:32:9
|
LL | let b = x.borrow_mut();
| ^
|
note: these are all the await points this ref is held through
--> $DIR/await_holding_refcell_ref.rs:33:5
--> $DIR/await_holding_refcell_ref.rs:32:5
|
LL | / let b = x.borrow_mut();
LL | |
@ -46,13 +46,13 @@ LL | | }
| |_^
error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:45:9
--> $DIR/await_holding_refcell_ref.rs:44:9
|
LL | let b = x.borrow_mut();
| ^
|
note: these are all the await points this ref is held through
--> $DIR/await_holding_refcell_ref.rs:45:5
--> $DIR/await_holding_refcell_ref.rs:44:5
|
LL | / let b = x.borrow_mut();
LL | |
@ -64,13 +64,13 @@ LL | | }
| |_^
error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:60:13
--> $DIR/await_holding_refcell_ref.rs:59:13
|
LL | let b = x.borrow_mut();
| ^
|
note: these are all the await points this ref is held through
--> $DIR/await_holding_refcell_ref.rs:60:9
--> $DIR/await_holding_refcell_ref.rs:59:9
|
LL | / let b = x.borrow_mut();
LL | | baz().await
@ -78,13 +78,13 @@ LL | | };
| |_____^
error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:72:13
--> $DIR/await_holding_refcell_ref.rs:71:13
|
LL | let b = x.borrow_mut();
| ^
|
note: these are all the await points this ref is held through
--> $DIR/await_holding_refcell_ref.rs:72:9
--> $DIR/await_holding_refcell_ref.rs:71:9
|
LL | / let b = x.borrow_mut();
LL | | baz().await

View file

@ -7,7 +7,6 @@
// in type inference.
#![feature(trivial_bounds)]
#![allow(unused)]
trait A {}
impl A for i32 {}
@ -22,9 +21,9 @@ where
fn unsized_local()
where
for<'a> Dst<A + 'a>: Sized,
for<'a> Dst<dyn A + 'a>: Sized,
{
let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
let x: Dst<dyn A> = *(Box::new(Dst { x: 1 }) as Box<Dst<dyn A>>);
}
fn return_str() -> str

View file

@ -1,30 +1,34 @@
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/ice-3969.rs:25:17
error: trait bound str: std::marker::Sized does not depend on any type or lifetime parameters
--> $DIR/ice-3969.rs:20:10
|
LL | for<'a> Dst<A + 'a>: Sized,
| ^^^^^^ help: use `dyn`: `dyn A + 'a`
LL | str: Sized;
| ^^^^^
|
= note: `-D bare-trait-objects` implied by `-D warnings`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `-D trivial-bounds` implied by `-D warnings`
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/ice-3969.rs:27:16
error: trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters
--> $DIR/ice-3969.rs:24:30
|
LL | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
| ^ help: use `dyn`: `dyn A`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
LL | for<'a> Dst<dyn A + 'a>: Sized,
| ^^^^^
error: trait objects without an explicit `dyn` are deprecated
--> $DIR/ice-3969.rs:27:57
error: trait bound str: std::marker::Sized does not depend on any type or lifetime parameters
--> $DIR/ice-3969.rs:31:10
|
LL | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
| ^ help: use `dyn`: `dyn A`
LL | str: Sized,
| ^^^^^
error: trait bound std::string::String: std::ops::Neg does not depend on any type or lifetime parameters
--> $DIR/ice-3969.rs:38:13
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
LL | String: ::std::ops::Neg<Output = String>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
error: trait bound i32: std::iter::Iterator does not depend on any type or lifetime parameters
--> $DIR/ice-3969.rs:45:10
|
LL | i32: Iterator,
| ^^^^^^^^
error: aborting due to 5 previous errors

View file

@ -1,5 +1,3 @@
// edition:2018
// Regression test for https://github.com/rust-lang/rust-clippy/issues/5207
pub async fn bar<'a, T: 'a>(_: T) {}

View file

@ -1,6 +1,5 @@
// originally from glacier fixed/77919.rs
// encountered errors resolving bounds after type-checking
trait TypeVal<T> {
const VAL: T;
}

View file

@ -1,16 +1,20 @@
error[E0412]: cannot find type `PhantomData` in this scope
--> $DIR/ice-6252.rs:9:9
--> $DIR/ice-6252.rs:8:9
|
LL | _n: PhantomData,
| ^^^^^^^^^^^ not found in this scope
|
help: consider importing this struct
help: consider importing one of these items
|
LL | use serde::__private::PhantomData;
|
LL | use std::marker::PhantomData;
|
LL | use core::marker::PhantomData;
|
error[E0412]: cannot find type `VAL` in this scope
--> $DIR/ice-6252.rs:11:63
--> $DIR/ice-6252.rs:10:63
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| - ^^^ not found in this scope
@ -18,7 +22,7 @@ LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| help: you might be missing a type parameter: `, VAL`
error[E0046]: not all trait items implemented, missing: `VAL`
--> $DIR/ice-6252.rs:11:1
--> $DIR/ice-6252.rs:10:1
|
LL | const VAL: T;
| ------------- `VAL` from trait

View file

@ -1,4 +1,3 @@
// edition:2018
#![allow(clippy::never_loop)]
async fn f() {

View file

@ -1,5 +1,3 @@
// edition:2018
use serde::Deserialize;
/// Tests that we do not lint for unused underscores in a `MacroAttribute`

View file

@ -1,9 +1,9 @@
// compile-flags: --edition=2018
#![feature(custom_inner_attributes)]
#![rustfmt::skip]
#![warn(clippy::debug_assert_with_mut_call)]
#![allow(clippy::redundant_closure_call)]
struct S;
impl S {

View file

@ -1,6 +1,5 @@
#![warn(clippy::diverging_sub_expression)]
#![allow(clippy::match_same_arms, clippy::logic_bug)]
#[allow(clippy::empty_loop)]
fn diverge() -> ! {
loop {}

View file

@ -1,5 +1,5 @@
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:20:10
--> $DIR/diverging_sub_expression.rs:19:10
|
LL | b || diverge();
| ^^^^^^^^^
@ -7,34 +7,42 @@ LL | b || diverge();
= note: `-D clippy::diverging-sub-expression` implied by `-D warnings`
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:21:10
--> $DIR/diverging_sub_expression.rs:20:10
|
LL | b || A.foo();
| ^^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:30:26
--> $DIR/diverging_sub_expression.rs:29:26
|
LL | 6 => true || return,
| ^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:31:26
--> $DIR/diverging_sub_expression.rs:30:26
|
LL | 7 => true || continue,
| ^^^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:34:26
--> $DIR/diverging_sub_expression.rs:33:26
|
LL | 3 => true || diverge(),
| ^^^^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:39:26
--> $DIR/diverging_sub_expression.rs:36:30
|
LL | _ => true || panic!("boo"),
| ^^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:38:26
|
LL | _ => true || break,
| ^^^^^
error: aborting due to 6 previous errors
error: aborting due to 7 previous errors

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::missing_errors_doc)]
#![allow(clippy::result_unit_err)]
#![allow(clippy::unnecessary_wraps)]

View file

@ -1,5 +1,5 @@
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:8:1
--> $DIR/doc_errors.rs:7:1
|
LL | / pub fn pub_fn_missing_errors_header() -> Result<(), ()> {
LL | | unimplemented!();
@ -9,7 +9,7 @@ LL | | }
= note: `-D clippy::missing-errors-doc` implied by `-D warnings`
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:12:1
--> $DIR/doc_errors.rs:11:1
|
LL | / pub async fn async_pub_fn_missing_errors_header() -> Result<(), ()> {
LL | | unimplemented!();
@ -17,7 +17,7 @@ LL | | }
| |_^
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:17:1
--> $DIR/doc_errors.rs:16:1
|
LL | / pub fn pub_fn_returning_io_result() -> io::Result<()> {
LL | | unimplemented!();
@ -25,7 +25,7 @@ LL | | }
| |_^
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:22:1
--> $DIR/doc_errors.rs:21:1
|
LL | / pub async fn async_pub_fn_returning_io_result() -> io::Result<()> {
LL | | unimplemented!();
@ -33,7 +33,7 @@ LL | | }
| |_^
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:52:5
--> $DIR/doc_errors.rs:51:5
|
LL | / pub fn pub_method_missing_errors_header() -> Result<(), ()> {
LL | | unimplemented!();
@ -41,7 +41,7 @@ LL | | }
| |_____^
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:57:5
--> $DIR/doc_errors.rs:56:5
|
LL | / pub async fn async_pub_method_missing_errors_header() -> Result<(), ()> {
LL | | unimplemented!();
@ -49,7 +49,7 @@ LL | | }
| |_____^
error: docs for function returning `Result` missing `# Errors` section
--> $DIR/doc_errors.rs:86:5
--> $DIR/doc_errors.rs:85:5
|
LL | fn trait_method_missing_errors_header() -> Result<(), ()>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// edition:2018
#[warn(clippy::eval_order_dependence)]
#[allow(
unused_assignments,

View file

@ -1,48 +1,48 @@
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:16:9
--> $DIR/eval_order_dependence.rs:14:9
|
LL | } + x;
| ^
|
= note: `-D clippy::eval-order-dependence` implied by `-D warnings`
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:14:9
--> $DIR/eval_order_dependence.rs:12:9
|
LL | x = 1;
| ^^^^^
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:19:5
--> $DIR/eval_order_dependence.rs:17:5
|
LL | x += {
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:20:9
--> $DIR/eval_order_dependence.rs:18:9
|
LL | x = 20;
| ^^^^^^
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:32:12
--> $DIR/eval_order_dependence.rs:30:12
|
LL | a: x,
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:34:13
--> $DIR/eval_order_dependence.rs:32:13
|
LL | x = 6;
| ^^^^^
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:41:9
--> $DIR/eval_order_dependence.rs:39:9
|
LL | x += {
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:42:13
--> $DIR/eval_order_dependence.rs:40:13
|
LL | x = 20;
| ^^^^^^

View file

@ -38,7 +38,7 @@ note: potential failure(s)
|
LL | panic!();
| ^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:35:1
@ -65,7 +65,7 @@ LL | } else if s.parse::<u32>().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:53:1
@ -87,7 +87,7 @@ LL | if s.parse::<u32>().ok().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::future_not_send)]
use std::cell::Cell;

View file

@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:8:62
--> $DIR/future_not_send.rs:7:62
|
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ future returned by `private_future` is not `Send`
|
= note: `-D clippy::future-not-send` implied by `-D warnings`
note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:9:5
--> $DIR/future_not_send.rs:8:5
|
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| -- has type `std::rc::Rc<[u8]>` which is not `Send`
@ -16,7 +16,7 @@ LL | }
| - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:9:5
--> $DIR/future_not_send.rs:8:5
|
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ---- has type `&std::cell::Cell<usize>` which is not `Send`
@ -27,13 +27,13 @@ LL | }
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:12:42
--> $DIR/future_not_send.rs:11:42
|
LL | pub async fn public_future(rc: Rc<[u8]>) {
| ^ future returned by `public_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:13:5
--> $DIR/future_not_send.rs:12:5
|
LL | pub async fn public_future(rc: Rc<[u8]>) {
| -- has type `std::rc::Rc<[u8]>` which is not `Send`
@ -44,45 +44,45 @@ LL | }
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:20:63
--> $DIR/future_not_send.rs:19:63
|
LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ future returned by `private_future2` is not `Send`
|
note: captured value is not `Send`
--> $DIR/future_not_send.rs:20:26
--> $DIR/future_not_send.rs:19:26
|
LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^ has type `std::rc::Rc<[u8]>` which is not `Send`
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> $DIR/future_not_send.rs:20:40
--> $DIR/future_not_send.rs:19:40
|
LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ has type `&std::cell::Cell<usize>` which is not `Send`, because `std::cell::Cell<usize>` is not `Sync`
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:24:43
--> $DIR/future_not_send.rs:23:43
|
LL | pub async fn public_future2(rc: Rc<[u8]>) {}
| ^ future returned by `public_future2` is not `Send`
|
note: captured value is not `Send`
--> $DIR/future_not_send.rs:24:29
--> $DIR/future_not_send.rs:23:29
|
LL | pub async fn public_future2(rc: Rc<[u8]>) {}
| ^^ has type `std::rc::Rc<[u8]>` which is not `Send`
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:35:39
--> $DIR/future_not_send.rs:34:39
|
LL | async fn private_future(&self) -> usize {
| ^^^^^ future returned by `private_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:36:9
--> $DIR/future_not_send.rs:35:9
|
LL | async fn private_future(&self) -> usize {
| ----- has type `&Dummy` which is not `Send`
@ -94,13 +94,13 @@ LL | }
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:40:39
--> $DIR/future_not_send.rs:39:39
|
LL | pub async fn public_future(&self) {
| ^ future returned by `public_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:41:9
--> $DIR/future_not_send.rs:40:9
|
LL | pub async fn public_future(&self) {
| ----- has type `&Dummy` which is not `Send`
@ -111,13 +111,13 @@ LL | }
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:50:37
--> $DIR/future_not_send.rs:49:37
|
LL | async fn generic_future<T>(t: T) -> T
| ^ future returned by `generic_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:55:5
--> $DIR/future_not_send.rs:54:5
|
LL | let rt = &t;
| -- has type `&T` which is not `Send`
@ -129,13 +129,13 @@ LL | }
= note: `T` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> $DIR/future_not_send.rs:66:34
--> $DIR/future_not_send.rs:65:34
|
LL | async fn unclear_future<T>(t: T) {}
| ^ future returned by `unclear_future` is not `Send`
|
note: captured value is not `Send`
--> $DIR/future_not_send.rs:66:28
--> $DIR/future_not_send.rs:65:28
|
LL | async fn unclear_future<T>(t: T) {}
| ^ has type `T` which is not `Send`

View file

@ -1,4 +1,3 @@
// edition:2018
// aux-build:implicit_hasher_macros.rs
#![deny(clippy::implicit_hasher)]
#![allow(unused)]

View file

@ -1,11 +1,11 @@
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:17:35
--> $DIR/implicit_hasher.rs:16:35
|
LL | impl<K: Hash + Eq, V> Foo<i8> for HashMap<K, V> {
| ^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/implicit_hasher.rs:3:9
--> $DIR/implicit_hasher.rs:2:9
|
LL | #![deny(clippy::implicit_hasher)]
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -19,7 +19,7 @@ LL | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default:
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:26:36
--> $DIR/implicit_hasher.rs:25:36
|
LL | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) {
| ^^^^^^^^^^^^^
@ -34,7 +34,7 @@ LL | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Defa
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:31:19
--> $DIR/implicit_hasher.rs:30:19
|
LL | impl Foo<i16> for HashMap<String, String> {
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -49,7 +49,7 @@ LL | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default:
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:48:32
--> $DIR/implicit_hasher.rs:47:32
|
LL | impl<T: Hash + Eq> Foo<i8> for HashSet<T> {
| ^^^^^^^^^^
@ -64,7 +64,7 @@ LL | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default:
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:53:19
--> $DIR/implicit_hasher.rs:52:19
|
LL | impl Foo<i16> for HashSet<String> {
| ^^^^^^^^^^^^^^^
@ -79,7 +79,7 @@ LL | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default:
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:70:23
--> $DIR/implicit_hasher.rs:69:23
|
LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _s
| +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:70:53
--> $DIR/implicit_hasher.rs:69:53
|
LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^
@ -101,7 +101,7 @@ LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set:
| +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:74:43
--> $DIR/implicit_hasher.rs:73:43
|
LL | impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
| ^^^^^^^^^^^^^
@ -120,7 +120,7 @@ LL | (HashMap::default(), HashMap::with_capacity_and_hasher(10,
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:82:33
--> $DIR/implicit_hasher.rs:81:33
|
LL | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^
@ -135,7 +135,7 @@ LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i
| +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:82:63
--> $DIR/implicit_hasher.rs:81:63
|
LL | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^
@ -150,7 +150,7 @@ LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i
| +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:101:35
--> $DIR/implicit_hasher.rs:100:35
|
LL | pub async fn election_vote(_data: HashMap<i32, i32>) {}
| ^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
// edition:2018
// run-rustfix
#![warn(clippy::implicit_return)]

View file

@ -1,4 +1,3 @@
// edition:2018
// run-rustfix
#![warn(clippy::implicit_return)]

View file

@ -1,5 +1,5 @@
error: missing `return` statement
--> $DIR/implicit_return.rs:13:5
--> $DIR/implicit_return.rs:12:5
|
LL | true
| ^^^^ help: add `return` as shown: `return true`
@ -7,85 +7,85 @@ LL | true
= note: `-D clippy::implicit-return` implied by `-D warnings`
error: missing `return` statement
--> $DIR/implicit_return.rs:17:15
--> $DIR/implicit_return.rs:16:15
|
LL | if true { true } else { false }
| ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:17:29
--> $DIR/implicit_return.rs:16:29
|
LL | if true { true } else { false }
| ^^^^^ help: add `return` as shown: `return false`
error: missing `return` statement
--> $DIR/implicit_return.rs:23:17
--> $DIR/implicit_return.rs:22:17
|
LL | true => false,
| ^^^^^ help: add `return` as shown: `return false`
error: missing `return` statement
--> $DIR/implicit_return.rs:24:20
--> $DIR/implicit_return.rs:23:20
|
LL | false => { true },
| ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:37:9
--> $DIR/implicit_return.rs:36:9
|
LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:44:13
--> $DIR/implicit_return.rs:43:13
|
LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:52:13
--> $DIR/implicit_return.rs:51:13
|
LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:70:18
--> $DIR/implicit_return.rs:69:18
|
LL | let _ = || { true };
| ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:71:16
--> $DIR/implicit_return.rs:70:16
|
LL | let _ = || true;
| ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:79:5
--> $DIR/implicit_return.rs:78:5
|
LL | format!("test {}", "test")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")`
error: missing `return` statement
--> $DIR/implicit_return.rs:88:5
--> $DIR/implicit_return.rs:87:5
|
LL | m!(true, false)
| ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)`
error: missing `return` statement
--> $DIR/implicit_return.rs:94:13
--> $DIR/implicit_return.rs:93:13
|
LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement
--> $DIR/implicit_return.rs:99:17
--> $DIR/implicit_return.rs:98:17
|
LL | break 'outer false;
| ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false`
error: missing `return` statement
--> $DIR/implicit_return.rs:114:5
--> $DIR/implicit_return.rs:113:5
|
LL | / loop {
LL | | m!(true);
@ -100,7 +100,7 @@ LL + }
|
error: missing `return` statement
--> $DIR/implicit_return.rs:128:5
--> $DIR/implicit_return.rs:127:5
|
LL | true
| ^^^^ help: add `return` as shown: `return true`

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::inconsistent_struct_constructor)]
#![allow(clippy::redundant_field_names)]
#![allow(clippy::unnecessary_operation)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::inconsistent_struct_constructor)]
#![allow(clippy::redundant_field_names)]
#![allow(clippy::unnecessary_operation)]

View file

@ -1,5 +1,5 @@
error: struct constructor field order is inconsistent with struct definition field order
--> $DIR/inconsistent_struct_constructor.rs:34:9
--> $DIR/inconsistent_struct_constructor.rs:33:9
|
LL | Foo { y, x, z };
| ^^^^^^^^^^^^^^^ help: try: `Foo { x, y, z }`
@ -7,7 +7,7 @@ LL | Foo { y, x, z };
= note: `-D clippy::inconsistent-struct-constructor` implied by `-D warnings`
error: struct constructor field order is inconsistent with struct definition field order
--> $DIR/inconsistent_struct_constructor.rs:56:9
--> $DIR/inconsistent_struct_constructor.rs:55:9
|
LL | / Foo {
LL | | z,

View file

@ -0,0 +1,19 @@
error: sub-expression diverges
--> $DIR/issue-7447.rs:23:15
|
LL | byte_view(panic!());
| ^^^^^^^^
|
= note: `-D clippy::diverging-sub-expression` implied by `-D warnings`
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: sub-expression diverges
--> $DIR/issue-7447.rs:24:19
|
LL | group_entries(panic!());
| ^^^^^^^^
|
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

View file

@ -1,4 +1,3 @@
// edition:2018
#![allow(dead_code)]
async fn sink1<'a>(_: &'a str) {} // lint

View file

@ -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/issue_4266.rs:4:1
--> $DIR/issue_4266.rs:3:1
|
LL | async fn sink1<'a>(_: &'a str) {} // lint
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | async fn sink1<'a>(_: &'a str) {} // lint
= 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/issue_4266.rs:8:1
--> $DIR/issue_4266.rs:7:1
|
LL | async fn one_to_one<'a>(s: &'a str) -> &'a str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// edition:2018
#![warn(clippy::len_without_is_empty)]
#![allow(dead_code, unused)]

View file

@ -1,5 +1,5 @@
error: struct `PubOne` has a public `len` method, but no `is_empty` method
--> $DIR/len_without_is_empty.rs:9:5
--> $DIR/len_without_is_empty.rs:7:5
|
LL | pub fn len(&self) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | pub fn len(&self) -> isize {
= note: `-D clippy::len-without-is-empty` implied by `-D warnings`
error: trait `PubTraitsToo` has a `len` method but no (possibly inherited) `is_empty` method
--> $DIR/len_without_is_empty.rs:57:1
--> $DIR/len_without_is_empty.rs:55:1
|
LL | / pub trait PubTraitsToo {
LL | | fn len(&self) -> isize;
@ -15,45 +15,45 @@ LL | | }
| |_^
error: struct `HasIsEmpty` has a public `len` method, but a private `is_empty` method
--> $DIR/len_without_is_empty.rs:70:5
--> $DIR/len_without_is_empty.rs:68:5
|
LL | pub fn len(&self) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `is_empty` defined here
--> $DIR/len_without_is_empty.rs:74:5
--> $DIR/len_without_is_empty.rs:72:5
|
LL | fn is_empty(&self) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: struct `HasWrongIsEmpty` has a public `len` method, but the `is_empty` method has an unexpected signature
--> $DIR/len_without_is_empty.rs:82:5
--> $DIR/len_without_is_empty.rs:80:5
|
LL | pub fn len(&self) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `is_empty` defined here
--> $DIR/len_without_is_empty.rs:86:5
--> $DIR/len_without_is_empty.rs:84:5
|
LL | pub fn is_empty(&self, x: u32) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature: `(&self) -> bool`
error: struct `MismatchedSelf` has a public `len` method, but the `is_empty` method has an unexpected signature
--> $DIR/len_without_is_empty.rs:94:5
--> $DIR/len_without_is_empty.rs:92:5
|
LL | pub fn len(self) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `is_empty` defined here
--> $DIR/len_without_is_empty.rs:98:5
--> $DIR/len_without_is_empty.rs:96:5
|
LL | pub fn is_empty(&self) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature: `(self) -> bool`
error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method
--> $DIR/len_without_is_empty.rs:173:1
--> $DIR/len_without_is_empty.rs:171:1
|
LL | / pub trait DependsOnFoo: Foo {
LL | | fn len(&mut self) -> usize;
@ -61,33 +61,33 @@ LL | | }
| |_^
error: struct `OptionalLen3` has a public `len` method, but the `is_empty` method has an unexpected signature
--> $DIR/len_without_is_empty.rs:218:5
--> $DIR/len_without_is_empty.rs:216:5
|
LL | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `is_empty` defined here
--> $DIR/len_without_is_empty.rs:223:5
--> $DIR/len_without_is_empty.rs:221:5
|
LL | pub fn is_empty(&self) -> Option<bool> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature: `(&self) -> bool`
error: struct `ResultLen` has a public `len` method, but the `is_empty` method has an unexpected signature
--> $DIR/len_without_is_empty.rs:230:5
--> $DIR/len_without_is_empty.rs:228:5
|
LL | pub fn len(&self) -> Result<usize, ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `is_empty` defined here
--> $DIR/len_without_is_empty.rs:235:5
--> $DIR/len_without_is_empty.rs:233:5
|
LL | pub fn is_empty(&self) -> Option<bool> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature: `(&self) -> bool` or `(&self) -> Result<bool>
error: this returns a `Result<_, ()>`
--> $DIR/len_without_is_empty.rs:230:5
--> $DIR/len_without_is_empty.rs:228:5
|
LL | pub fn len(&self) -> Result<usize, ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -96,7 +96,7 @@ LL | pub fn len(&self) -> Result<usize, ()> {
= help: use a custom `Error` type instead
error: this returns a `Result<_, ()>`
--> $DIR/len_without_is_empty.rs:242:5
--> $DIR/len_without_is_empty.rs:240:5
|
LL | pub fn len(&self) -> Result<usize, ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -104,7 +104,7 @@ LL | pub fn len(&self) -> Result<usize, ()> {
= help: use a custom `Error` type instead
error: this returns a `Result<_, ()>`
--> $DIR/len_without_is_empty.rs:246:5
--> $DIR/len_without_is_empty.rs:244:5
|
LL | pub fn is_empty(&self) -> Result<bool, ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -112,7 +112,7 @@ LL | pub fn is_empty(&self) -> Result<bool, ()> {
= help: use a custom `Error` type instead
error: this returns a `Result<_, ()>`
--> $DIR/len_without_is_empty.rs:253:5
--> $DIR/len_without_is_empty.rs:251:5
|
LL | pub fn len(&self) -> Result<usize, ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
// compile-flags: --edition 2018
// aux-build:macro_rules.rs
// aux-build:macro_use_helper.rs
// aux-build:proc_macro_derive.rs

View file

@ -1,4 +1,3 @@
// compile-flags: --edition 2018
// aux-build:macro_rules.rs
// aux-build:macro_use_helper.rs
// aux-build:proc_macro_derive.rs

View file

@ -1,5 +1,5 @@
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_imports.rs:19:5
--> $DIR/macro_use_imports.rs:18:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};`
@ -7,22 +7,22 @@ LL | #[macro_use]
= note: `-D clippy::macro-use-imports` implied by `-D warnings`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_imports.rs:25:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_imports.rs:21:5
--> $DIR/macro_use_imports.rs:20:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_imports.rs:23:5
--> $DIR/macro_use_imports.rs:22:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::foofoo, inner::try_err};`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_imports.rs:24:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;`
error: aborting due to 4 previous errors

View file

@ -1,4 +1,6 @@
// edition:2018
// run-rustfix
//FIXME: This does not correctly match in edition 2021, see #7843
#![warn(clippy::manual_assert)]
fn main() {

View file

@ -1,4 +1,6 @@
// edition:2018
// run-rustfix
//FIXME: This does not correctly match in edition 2021, see #7843
#![warn(clippy::manual_assert)]
fn main() {

View file

@ -1,5 +1,5 @@
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:19:5
--> $DIR/manual_assert.rs:21:5
|
LL | / if !a.is_empty() {
LL | | panic!("qaqaq{:?}", a);
@ -9,7 +9,7 @@ LL | | }
= note: `-D clippy::manual-assert` implied by `-D warnings`
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:22:5
--> $DIR/manual_assert.rs:24:5
|
LL | / if !a.is_empty() {
LL | | panic!("qwqwq");
@ -17,7 +17,7 @@ LL | | }
| |_____^ help: try: `assert!(a.is_empty(), "qwqwq");`
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:39:5
--> $DIR/manual_assert.rs:41:5
|
LL | / if b.is_empty() {
LL | | panic!("panic1");
@ -25,7 +25,7 @@ LL | | }
| |_____^ help: try: `assert!(!b.is_empty(), "panic1");`
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:42:5
--> $DIR/manual_assert.rs:44:5
|
LL | / if b.is_empty() && a.is_empty() {
LL | | panic!("panic2");
@ -33,7 +33,7 @@ LL | | }
| |_____^ help: try: `assert!(!(b.is_empty() && a.is_empty()), "panic2");`
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:45:5
--> $DIR/manual_assert.rs:47:5
|
LL | / if a.is_empty() && !b.is_empty() {
LL | | panic!("panic3");
@ -41,7 +41,7 @@ LL | | }
| |_____^ help: try: `assert!(!(a.is_empty() && !b.is_empty()), "panic3");`
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:48:5
--> $DIR/manual_assert.rs:50:5
|
LL | / if b.is_empty() || a.is_empty() {
LL | | panic!("panic4");
@ -49,7 +49,7 @@ LL | | }
| |_____^ help: try: `assert!(!(b.is_empty() || a.is_empty()), "panic4");`
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:51:5
--> $DIR/manual_assert.rs:53:5
|
LL | / if a.is_empty() || !b.is_empty() {
LL | | panic!("panic5");

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::manual_async_fn)]
#![allow(unused)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::manual_async_fn)]
#![allow(unused)]

View file

@ -1,5 +1,5 @@
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:8:1
--> $DIR/manual_async_fn.rs:7:1
|
LL | fn fut() -> impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -15,7 +15,7 @@ LL | fn fut() -> impl Future<Output = i32> { 42 }
| ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:13:1
--> $DIR/manual_async_fn.rs:12:1
|
LL | fn fut2() ->impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -30,7 +30,7 @@ LL | fn fut2() ->impl Future<Output = i32> { 42 }
| ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:18:1
--> $DIR/manual_async_fn.rs:17:1
|
LL | fn fut3()-> impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -45,7 +45,7 @@ LL | fn fut3()-> impl Future<Output = i32> { 42 }
| ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:22:1
--> $DIR/manual_async_fn.rs:21:1
|
LL | fn empty_fut() -> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -60,7 +60,7 @@ LL | fn empty_fut() -> impl Future<Output = ()> {}
| ~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:27:1
--> $DIR/manual_async_fn.rs:26:1
|
LL | fn empty_fut2() ->impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -75,7 +75,7 @@ LL | fn empty_fut2() ->impl Future<Output = ()> {}
| ~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:32:1
--> $DIR/manual_async_fn.rs:31:1
|
LL | fn empty_fut3()-> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | fn empty_fut3()-> impl Future<Output = ()> {}
| ~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:36:1
--> $DIR/manual_async_fn.rs:35:1
|
LL | fn core_fut() -> impl core::future::Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -105,7 +105,7 @@ LL | fn core_fut() -> impl core::future::Future<Output = i32> { 42 }
| ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:58:5
--> $DIR/manual_async_fn.rs:57:5
|
LL | fn inh_fut() -> impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -125,7 +125,7 @@ LL + let c = 21;
...
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:93:1
--> $DIR/manual_async_fn.rs:92:1
|
LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -140,7 +140,7 @@ LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ { 42 }
| ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:102:1
--> $DIR/manual_async_fn.rs:101:1
|
LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
// edition:2018
// run-rustfix
#![warn(clippy::manual_map)]

View file

@ -1,4 +1,3 @@
// edition:2018
// run-rustfix
#![warn(clippy::manual_map)]

View file

@ -1,5 +1,5 @@
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:15:5
--> $DIR/manual_map_option.rs:14:5
|
LL | / match Some(0) {
LL | | Some(_) => Some(2),
@ -10,7 +10,7 @@ LL | | };
= note: `-D clippy::manual-map` implied by `-D warnings`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:20:5
--> $DIR/manual_map_option.rs:19:5
|
LL | / match Some(0) {
LL | | Some(x) => Some(x + 1),
@ -19,7 +19,7 @@ LL | | };
| |_____^ help: try this: `Some(0).map(|x| x + 1)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:25:5
--> $DIR/manual_map_option.rs:24:5
|
LL | / match Some("") {
LL | | Some(x) => Some(x.is_empty()),
@ -28,7 +28,7 @@ LL | | };
| |_____^ help: try this: `Some("").map(|x| x.is_empty())`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:30:5
--> $DIR/manual_map_option.rs:29:5
|
LL | / if let Some(x) = Some(0) {
LL | | Some(!x)
@ -38,7 +38,7 @@ LL | | };
| |_____^ help: try this: `Some(0).map(|x| !x)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:37:5
--> $DIR/manual_map_option.rs:36:5
|
LL | / match Some(0) {
LL | | Some(x) => { Some(std::convert::identity(x)) }
@ -47,7 +47,7 @@ LL | | };
| |_____^ help: try this: `Some(0).map(std::convert::identity)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:42:5
--> $DIR/manual_map_option.rs:41:5
|
LL | / match Some(&String::new()) {
LL | | Some(x) => Some(str::len(x)),
@ -56,7 +56,7 @@ LL | | };
| |_____^ help: try this: `Some(&String::new()).map(|x| str::len(x))`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:52:5
--> $DIR/manual_map_option.rs:51:5
|
LL | / match &Some([0, 1]) {
LL | | Some(x) => Some(x[0]),
@ -65,7 +65,7 @@ LL | | };
| |_____^ help: try this: `Some([0, 1]).as_ref().map(|x| x[0])`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:57:5
--> $DIR/manual_map_option.rs:56:5
|
LL | / match &Some(0) {
LL | | &Some(x) => Some(x * 2),
@ -74,7 +74,7 @@ LL | | };
| |_____^ help: try this: `Some(0).map(|x| x * 2)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:62:5
--> $DIR/manual_map_option.rs:61:5
|
LL | / match Some(String::new()) {
LL | | Some(ref x) => Some(x.is_empty()),
@ -83,7 +83,7 @@ LL | | };
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:67:5
--> $DIR/manual_map_option.rs:66:5
|
LL | / match &&Some(String::new()) {
LL | | Some(x) => Some(x.len()),
@ -92,7 +92,7 @@ LL | | };
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:72:5
--> $DIR/manual_map_option.rs:71:5
|
LL | / match &&Some(0) {
LL | | &&Some(x) => Some(x + x),
@ -101,7 +101,7 @@ LL | | };
| |_____^ help: try this: `Some(0).map(|x| x + x)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:85:9
--> $DIR/manual_map_option.rs:84:9
|
LL | / match &mut Some(String::new()) {
LL | | Some(x) => Some(x.push_str("")),
@ -110,7 +110,7 @@ LL | | };
| |_________^ help: try this: `Some(String::new()).as_mut().map(|x| x.push_str(""))`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:91:5
--> $DIR/manual_map_option.rs:90:5
|
LL | / match &mut Some(String::new()) {
LL | | Some(ref x) => Some(x.len()),
@ -119,7 +119,7 @@ LL | | };
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:96:5
--> $DIR/manual_map_option.rs:95:5
|
LL | / match &mut &Some(String::new()) {
LL | | Some(x) => Some(x.is_empty()),
@ -128,7 +128,7 @@ LL | | };
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:101:5
--> $DIR/manual_map_option.rs:100:5
|
LL | / match Some((0, 1, 2)) {
LL | | Some((x, y, z)) => Some(x + y + z),
@ -137,7 +137,7 @@ LL | | };
| |_____^ help: try this: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:106:5
--> $DIR/manual_map_option.rs:105:5
|
LL | / match Some([1, 2, 3]) {
LL | | Some([first, ..]) => Some(first),
@ -146,7 +146,7 @@ LL | | };
| |_____^ help: try this: `Some([1, 2, 3]).map(|[first, ..]| first)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:111:5
--> $DIR/manual_map_option.rs:110:5
|
LL | / match &Some((String::new(), "test")) {
LL | | Some((x, y)) => Some((y, x)),
@ -155,7 +155,7 @@ LL | | };
| |_____^ help: try this: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:169:5
--> $DIR/manual_map_option.rs:168:5
|
LL | / match Some(0) {
LL | | Some(x) => Some(vec![x]),
@ -164,7 +164,7 @@ LL | | };
| |_____^ help: try this: `Some(0).map(|x| vec![x])`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:174:5
--> $DIR/manual_map_option.rs:173:5
|
LL | / match option_env!("") {
LL | | Some(x) => Some(String::from(x)),
@ -173,7 +173,7 @@ LL | | };
| |_____^ help: try this: `option_env!("").map(String::from)`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:194:12
--> $DIR/manual_map_option.rs:193:12
|
LL | } else if let Some(x) = Some(0) {
| ____________^
@ -184,7 +184,7 @@ LL | | };
| |_____^ help: try this: `{ Some(0).map(|x| x + 1) }`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option.rs:202:12
--> $DIR/manual_map_option.rs:201:12
|
LL | } else if let Some(x) = Some(0) {
| ____________^

View file

@ -1,10 +1,12 @@
//edition:2015
//FIXME: The lint only triggers once on edition 2021, so I'm leaving this at 2015 for now.
#![feature(exclusive_range_pattern)]
#![allow(clippy::match_same_arms)]
#![warn(clippy::match_wild_err_arm)]
fn match_wild_err_arm() {
let x: Result<i32, &str> = Ok(3);
match x {
Ok(3) => println!("ok"),
Ok(_) => println!("ok"),

View file

@ -1,5 +1,5 @@
error: `Err(_)` matches all errors
--> $DIR/match_wild_err_arm.rs:11:9
--> $DIR/match_wild_err_arm.rs:13:9
|
LL | Err(_) => panic!("err"),
| ^^^^^^
@ -8,7 +8,7 @@ LL | Err(_) => panic!("err"),
= note: match each error separately or use the error output, or use `.except(msg)` if the error case is unreachable
error: `Err(_)` matches all errors
--> $DIR/match_wild_err_arm.rs:17:9
--> $DIR/match_wild_err_arm.rs:19:9
|
LL | Err(_) => panic!(),
| ^^^^^^
@ -16,7 +16,7 @@ LL | Err(_) => panic!(),
= note: match each error separately or use the error output, or use `.except(msg)` if the error case is unreachable
error: `Err(_)` matches all errors
--> $DIR/match_wild_err_arm.rs:23:9
--> $DIR/match_wild_err_arm.rs:25:9
|
LL | Err(_) => {
| ^^^^^^
@ -24,7 +24,7 @@ LL | Err(_) => {
= note: match each error separately or use the error output, or use `.except(msg)` if the error case is unreachable
error: `Err(_e)` matches all errors
--> $DIR/match_wild_err_arm.rs:31:9
--> $DIR/match_wild_err_arm.rs:33:9
|
LL | Err(_e) => panic!(),
| ^^^^^^^

View file

@ -1,5 +1,4 @@
// aux-build:option_helpers.rs
// edition:2018
#![warn(clippy::all, clippy::pedantic)]
#![allow(

View file

@ -1,5 +1,5 @@
error: methods called `new` usually return `Self`
--> $DIR/methods.rs:105:5
--> $DIR/methods.rs:104:5
|
LL | / fn new() -> i32 {
LL | | 0
@ -9,7 +9,7 @@ LL | | }
= note: `-D clippy::new-ret-no-self` implied by `-D warnings`
error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> $DIR/methods.rs:126:13
--> $DIR/methods.rs:125:13
|
LL | let _ = v.iter().filter(|&x| {
| _____________^

View file

@ -3,7 +3,6 @@
// injected intrinsics by the compiler.
#![allow(dead_code)]
#![feature(global_asm)]
//! Some garbage docs for the crate here
#![doc = "More garbage"]
@ -90,10 +89,10 @@ mod internal_impl {
}
/// dox
pub mod public_interface {
pub use internal_impl::documented as foo;
pub use internal_impl::globbed::*;
pub use internal_impl::undocumented1 as bar;
pub use internal_impl::{documented, undocumented2};
pub use crate::internal_impl::documented as foo;
pub use crate::internal_impl::globbed::*;
pub use crate::internal_impl::undocumented1 as bar;
pub use crate::internal_impl::{documented, undocumented2};
}
fn main() {}

View file

@ -1,5 +1,5 @@
error: missing documentation for a type alias
--> $DIR/missing-doc.rs:10:1
--> $DIR/missing-doc.rs:9:1
|
LL | type Typedef = String;
| ^^^^^^^^^^^^^^^^^^^^^^
@ -7,37 +7,37 @@ LL | type Typedef = String;
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
error: missing documentation for a type alias
--> $DIR/missing-doc.rs:11:1
--> $DIR/missing-doc.rs:10:1
|
LL | pub type PubTypedef = String;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a module
--> $DIR/missing-doc.rs:13:1
--> $DIR/missing-doc.rs:12:1
|
LL | mod module_no_dox {}
| ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a module
--> $DIR/missing-doc.rs:14:1
--> $DIR/missing-doc.rs:13:1
|
LL | pub mod pub_module_no_dox {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> $DIR/missing-doc.rs:18:1
--> $DIR/missing-doc.rs:17:1
|
LL | pub fn foo2() {}
| ^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> $DIR/missing-doc.rs:19:1
--> $DIR/missing-doc.rs:18:1
|
LL | fn foo3() {}
| ^^^^^^^^^^^^
error: missing documentation for an enum
--> $DIR/missing-doc.rs:33:1
--> $DIR/missing-doc.rs:32:1
|
LL | / enum Baz {
LL | | BazA { a: isize, b: isize },
@ -46,31 +46,31 @@ LL | | }
| |_^
error: missing documentation for a variant
--> $DIR/missing-doc.rs:34:5
--> $DIR/missing-doc.rs:33:5
|
LL | BazA { a: isize, b: isize },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a struct field
--> $DIR/missing-doc.rs:34:12
--> $DIR/missing-doc.rs:33:12
|
LL | BazA { a: isize, b: isize },
| ^^^^^^^^
error: missing documentation for a struct field
--> $DIR/missing-doc.rs:34:22
--> $DIR/missing-doc.rs:33:22
|
LL | BazA { a: isize, b: isize },
| ^^^^^^^^
error: missing documentation for a variant
--> $DIR/missing-doc.rs:35:5
--> $DIR/missing-doc.rs:34:5
|
LL | BarB,
| ^^^^
error: missing documentation for an enum
--> $DIR/missing-doc.rs:38:1
--> $DIR/missing-doc.rs:37:1
|
LL | / pub enum PubBaz {
LL | | PubBazA { a: isize },
@ -78,43 +78,43 @@ LL | | }
| |_^
error: missing documentation for a variant
--> $DIR/missing-doc.rs:39:5
--> $DIR/missing-doc.rs:38:5
|
LL | PubBazA { a: isize },
| ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a struct field
--> $DIR/missing-doc.rs:39:15
--> $DIR/missing-doc.rs:38:15
|
LL | PubBazA { a: isize },
| ^^^^^^^^
error: missing documentation for a constant
--> $DIR/missing-doc.rs:59:1
--> $DIR/missing-doc.rs:58:1
|
LL | const FOO: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^
error: missing documentation for a constant
--> $DIR/missing-doc.rs:66:1
--> $DIR/missing-doc.rs:65:1
|
LL | pub const FOO4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a static
--> $DIR/missing-doc.rs:68:1
--> $DIR/missing-doc.rs:67:1
|
LL | static BAR: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a static
--> $DIR/missing-doc.rs:75:1
--> $DIR/missing-doc.rs:74:1
|
LL | pub static BAR4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a module
--> $DIR/missing-doc.rs:77:1
--> $DIR/missing-doc.rs:76:1
|
LL | / mod internal_impl {
LL | | /// dox
@ -126,31 +126,31 @@ LL | | }
| |_^
error: missing documentation for a function
--> $DIR/missing-doc.rs:80:5
--> $DIR/missing-doc.rs:79:5
|
LL | pub fn undocumented1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> $DIR/missing-doc.rs:81:5
--> $DIR/missing-doc.rs:80:5
|
LL | pub fn undocumented2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> $DIR/missing-doc.rs:82:5
--> $DIR/missing-doc.rs:81:5
|
LL | fn undocumented3() {}
| ^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> $DIR/missing-doc.rs:87:9
--> $DIR/missing-doc.rs:86:9
|
LL | pub fn also_undocumented1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> $DIR/missing-doc.rs:88:9
--> $DIR/missing-doc.rs:87:9
|
LL | fn also_undocumented2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,6 +1,5 @@
#![warn(clippy::missing_panics_doc)]
#![allow(clippy::option_map_unit_fn)]
fn main() {}
/// This needs to be documented

View file

@ -1,5 +1,5 @@
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:7:1
--> $DIR/missing_panics_doc.rs:6:1
|
LL | / pub fn unwrap() {
LL | | let result = Err("Hi");
@ -9,13 +9,13 @@ LL | | }
|
= note: `-D clippy::missing-panics-doc` implied by `-D warnings`
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:9:5
--> $DIR/missing_panics_doc.rs:8:5
|
LL | result.unwrap()
| ^^^^^^^^^^^^^^^
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:13:1
--> $DIR/missing_panics_doc.rs:12:1
|
LL | / pub fn panic() {
LL | | panic!("This function panics")
@ -23,14 +23,14 @@ LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:14:5
--> $DIR/missing_panics_doc.rs:13:5
|
LL | panic!("This function panics")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:18:1
--> $DIR/missing_panics_doc.rs:17:1
|
LL | / pub fn todo() {
LL | | todo!()
@ -38,14 +38,14 @@ LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:19:5
--> $DIR/missing_panics_doc.rs:18:5
|
LL | todo!()
| ^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:23:1
--> $DIR/missing_panics_doc.rs:22:1
|
LL | / pub fn inner_body(opt: Option<u32>) {
LL | | opt.map(|x| {
@ -57,14 +57,14 @@ LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:26:13
--> $DIR/missing_panics_doc.rs:25:13
|
LL | panic!()
| ^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:32:1
--> $DIR/missing_panics_doc.rs:31:1
|
LL | / pub fn unreachable_and_panic() {
LL | | if true { unreachable!() } else { panic!() }
@ -72,14 +72,14 @@ LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:33:39
--> $DIR/missing_panics_doc.rs:32:39
|
LL | if true { unreachable!() } else { panic!() }
| ^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:37:1
--> $DIR/missing_panics_doc.rs:36:1
|
LL | / pub fn assert_eq() {
LL | | let x = 0;
@ -88,14 +88,14 @@ LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:39:5
--> $DIR/missing_panics_doc.rs:38:5
|
LL | assert_eq!(x, 0);
| ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section
--> $DIR/missing_panics_doc.rs:43:1
--> $DIR/missing_panics_doc.rs:42:1
|
LL | / pub fn assert_ne() {
LL | | let x = 0;
@ -104,7 +104,7 @@ LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/missing_panics_doc.rs:45:5
--> $DIR/missing_panics_doc.rs:44:5
|
LL | assert_ne!(x, 0);
| ^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
// edition:2018
// FIXME: run-rustfix waiting on multi-span suggestions
#![warn(clippy::needless_borrow)]

View file

@ -1,5 +1,5 @@
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:60:14
--> $DIR/needless_borrow_pat.rs:59:14
|
LL | Some(ref x) => x,
| ^^^^^ help: try this: `x`
@ -7,7 +7,7 @@ LL | Some(ref x) => x,
= note: `-D clippy::needless-borrow` implied by `-D warnings`
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:66:14
--> $DIR/needless_borrow_pat.rs:65:14
|
LL | Some(ref x) => *x,
| ^^^^^
@ -18,7 +18,7 @@ LL | Some(x) => x,
| ~ ~
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:72:14
--> $DIR/needless_borrow_pat.rs:71:14
|
LL | Some(ref x) => {
| ^^^^^
@ -31,19 +31,19 @@ LL ~ f1(x);
|
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:82:14
--> $DIR/needless_borrow_pat.rs:81:14
|
LL | Some(ref x) => m1!(x),
| ^^^^^ help: try this: `x`
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:87:15
--> $DIR/needless_borrow_pat.rs:86:15
|
LL | let _ = |&ref x: &&String| {
| ^^^^^ help: try this: `x`
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:92:10
--> $DIR/needless_borrow_pat.rs:91:10
|
LL | let (ref y,) = (&x,);
| ^^^^^
@ -55,13 +55,13 @@ LL ~ let _: &String = y;
|
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:102:14
--> $DIR/needless_borrow_pat.rs:101:14
|
LL | Some(ref x) => x.0,
| ^^^^^ help: try this: `x`
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:112:14
--> $DIR/needless_borrow_pat.rs:111:14
|
LL | E::A(ref x) | E::B(ref x) => *x,
| ^^^^^ ^^^^^
@ -72,13 +72,13 @@ LL | E::A(x) | E::B(x) => x,
| ~ ~ ~
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:118:21
--> $DIR/needless_borrow_pat.rs:117:21
|
LL | if let Some(ref x) = Some(&String::new());
| ^^^^^ help: try this: `x`
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:126:12
--> $DIR/needless_borrow_pat.rs:125:12
|
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
| ^^^^^
@ -91,13 +91,13 @@ LL ~ x
|
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:133:11
--> $DIR/needless_borrow_pat.rs:132:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^ help: try this: `x`
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:141:11
--> $DIR/needless_borrow_pat.rs:140:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![feature(let_else)]
#![allow(unused)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![feature(let_else)]
#![allow(unused)]

View file

@ -1,5 +1,5 @@
error: unneeded `return` statement
--> $DIR/needless_return.rs:25:5
--> $DIR/needless_return.rs:24:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
@ -7,187 +7,187 @@ LL | return true;
= note: `-D clippy::needless-return` implied by `-D warnings`
error: unneeded `return` statement
--> $DIR/needless_return.rs:29:5
--> $DIR/needless_return.rs:28:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:34:9
--> $DIR/needless_return.rs:33:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:36:9
--> $DIR/needless_return.rs:35:9
|
LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement
--> $DIR/needless_return.rs:42:17
--> $DIR/needless_return.rs:41:17
|
LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement
--> $DIR/needless_return.rs:44:13
--> $DIR/needless_return.rs:43:13
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:51:9
--> $DIR/needless_return.rs:50:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:53:16
--> $DIR/needless_return.rs:52:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:61:5
--> $DIR/needless_return.rs:60:5
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:66:9
--> $DIR/needless_return.rs:65:9
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:68:9
--> $DIR/needless_return.rs:67:9
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:75:14
--> $DIR/needless_return.rs:74:14
|
LL | _ => return,
| ^^^^^^ help: replace `return` with an empty block: `{}`
error: unneeded `return` statement
--> $DIR/needless_return.rs:90:9
--> $DIR/needless_return.rs:89:9
|
LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")`
error: unneeded `return` statement
--> $DIR/needless_return.rs:92:9
--> $DIR/needless_return.rs:91:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()`
error: unneeded `return` statement
--> $DIR/needless_return.rs:113:32
--> $DIR/needless_return.rs:112:32
|
LL | bar.unwrap_or_else(|_| return)
| ^^^^^^ help: replace `return` with an empty block: `{}`
error: unneeded `return` statement
--> $DIR/needless_return.rs:118:13
--> $DIR/needless_return.rs:117:13
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:120:20
--> $DIR/needless_return.rs:119:20
|
LL | let _ = || return;
| ^^^^^^ help: replace `return` with an empty block: `{}`
error: unneeded `return` statement
--> $DIR/needless_return.rs:126:32
--> $DIR/needless_return.rs:125:32
|
LL | res.unwrap_or_else(|_| return Foo)
| ^^^^^^^^^^ help: remove `return`: `Foo`
error: unneeded `return` statement
--> $DIR/needless_return.rs:135:5
--> $DIR/needless_return.rs:134:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:139:5
--> $DIR/needless_return.rs:138:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:144:9
--> $DIR/needless_return.rs:143:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:146:9
--> $DIR/needless_return.rs:145:9
|
LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement
--> $DIR/needless_return.rs:152:17
--> $DIR/needless_return.rs:151:17
|
LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement
--> $DIR/needless_return.rs:154:13
--> $DIR/needless_return.rs:153:13
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:161:9
--> $DIR/needless_return.rs:160:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:163:16
--> $DIR/needless_return.rs:162:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement
--> $DIR/needless_return.rs:171:5
--> $DIR/needless_return.rs:170:5
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:176:9
--> $DIR/needless_return.rs:175:9
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:178:9
--> $DIR/needless_return.rs:177:9
|
LL | return;
| ^^^^^^^ help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:185:14
--> $DIR/needless_return.rs:184:14
|
LL | _ => return,
| ^^^^^^ help: replace `return` with an empty block: `{}`
error: unneeded `return` statement
--> $DIR/needless_return.rs:200:9
--> $DIR/needless_return.rs:199:9
|
LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")`
error: unneeded `return` statement
--> $DIR/needless_return.rs:202:9
--> $DIR/needless_return.rs:201:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()`

View file

@ -15,8 +15,8 @@ struct InstSplit {
impl MaybeInst {
fn fill(&mut self) {
let filled = match *self {
MaybeInst::Split1(goto1) => panic!(1),
MaybeInst::Split2(goto2) => panic!(2),
MaybeInst::Split1(goto1) => panic!("1"),
MaybeInst::Split2(goto2) => panic!("2"),
_ => unimplemented!(),
};
unimplemented!()

View file

@ -1,4 +1,3 @@
// edition:2018
// run-rustfix
#![warn(clippy::option_if_let_else)]
#![allow(clippy::redundant_closure, clippy::ref_option_ref, clippy::equatable_if_let)]

View file

@ -1,4 +1,3 @@
// edition:2018
// run-rustfix
#![warn(clippy::option_if_let_else)]
#![allow(clippy::redundant_closure, clippy::ref_option_ref, clippy::equatable_if_let)]

View file

@ -1,5 +1,5 @@
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:7:5
--> $DIR/option_if_let_else.rs:6:5
|
LL | / if let Some(x) = string {
LL | | (true, x)
@ -11,19 +11,19 @@ LL | | }
= note: `-D clippy::option-if-let-else` implied by `-D warnings`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:25:13
--> $DIR/option_if_let_else.rs:24:13
|
LL | let _ = if let Some(s) = *string { s.len() } else { 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:26:13
--> $DIR/option_if_let_else.rs:25:13
|
LL | let _ = if let Some(s) = &num { s } else { &0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:27:13
--> $DIR/option_if_let_else.rs:26:13
|
LL | let _ = if let Some(s) = &mut num {
| _____________^
@ -43,13 +43,13 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:33:13
--> $DIR/option_if_let_else.rs:32:13
|
LL | let _ = if let Some(ref s) = num { s } else { &0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:34:13
--> $DIR/option_if_let_else.rs:33:13
|
LL | let _ = if let Some(mut s) = num {
| _____________^
@ -69,7 +69,7 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:40:13
--> $DIR/option_if_let_else.rs:39:13
|
LL | let _ = if let Some(ref mut s) = num {
| _____________^
@ -89,7 +89,7 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:49:5
--> $DIR/option_if_let_else.rs:48:5
|
LL | / if let Some(x) = arg {
LL | | let y = x * x;
@ -108,7 +108,7 @@ LL + })
|
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:62:13
--> $DIR/option_if_let_else.rs:61:13
|
LL | let _ = if let Some(x) = arg {
| _____________^
@ -120,7 +120,7 @@ LL | | };
| |_____^ help: try: `arg.map_or_else(|| side_effect(), |x| x)`
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:71:13
--> $DIR/option_if_let_else.rs:70:13
|
LL | let _ = if let Some(x) = arg {
| _____________^
@ -143,13 +143,13 @@ LL ~ }, |x| x * x * x * x);
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:100:13
--> $DIR/option_if_let_else.rs:99:13
|
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:109:13
--> $DIR/option_if_let_else.rs:108:13
|
LL | let _ = if let Some(x) = Some(0) {
| _____________^
@ -171,13 +171,13 @@ LL ~ });
|
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:137:13
--> $DIR/option_if_let_else.rs:136:13
|
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or_else(|| s.len(), |x| s.len() + x)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:141:13
--> $DIR/option_if_let_else.rs:140:13
|
LL | let _ = if let Some(x) = Some(0) {
| _____________^

View file

@ -1,6 +1,5 @@
#![warn(clippy::panic_in_result_fn)]
#![allow(clippy::unnecessary_wraps)]
struct A;
impl A {

View file

@ -1,5 +1,5 @@
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:7:5
--> $DIR/panic_in_result_fn.rs:6: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!()`, `panic!()` or assertions 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:9:9
--> $DIR/panic_in_result_fn.rs:8:9
|
LL | panic!("error");
| ^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:12:5
--> $DIR/panic_in_result_fn.rs:11:5
|
LL | / fn result_with_unimplemented() -> Result<bool, String> // should emit lint
LL | | {
@ -27,14 +27,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions 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:14:9
--> $DIR/panic_in_result_fn.rs:13:9
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:17:5
--> $DIR/panic_in_result_fn.rs:16:5
|
LL | / fn result_with_unreachable() -> Result<bool, String> // should emit lint
LL | | {
@ -44,14 +44,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions 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:19:9
--> $DIR/panic_in_result_fn.rs:18:9
|
LL | unreachable!();
| ^^^^^^^^^^^^^^
= note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:22:5
--> $DIR/panic_in_result_fn.rs:21:5
|
LL | / fn result_with_todo() -> Result<bool, String> // should emit lint
LL | | {
@ -61,14 +61,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions 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:24:9
--> $DIR/panic_in_result_fn.rs:23:9
|
LL | todo!("Finish this");
| ^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:53:1
--> $DIR/panic_in_result_fn.rs:52:1
|
LL | / fn function_result_with_panic() -> Result<bool, String> // should emit lint
LL | | {
@ -78,14 +78,14 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions 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:55:5
--> $DIR/panic_in_result_fn.rs:54:5
|
LL | panic!("error");
| ^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
--> $DIR/panic_in_result_fn.rs:68:1
--> $DIR/panic_in_result_fn.rs:67:1
|
LL | / fn main() -> Result<(), String> {
LL | | todo!("finish main method");
@ -95,7 +95,7 @@ LL | | }
|
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions 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:69:5
--> $DIR/panic_in_result_fn.rs:68:5
|
LL | todo!("finish main method");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -196,7 +196,7 @@ fn clone_then_move_cloned() {
fn foo<F: Fn()>(_: &Alpha, _: F) {}
let x = Alpha;
// ok, data is moved while the clone is in use.
foo(&x.clone(), move || {
foo(&x, move || {
let _ = x;
});

View file

@ -167,5 +167,17 @@ note: cloned value is neither consumed nor mutated
LL | let y = x.clone().join("matthias");
| ^^^^^^^^^
error: aborting due to 14 previous errors
error: redundant clone
--> $DIR/redundant_clone.rs:199:11
|
LL | foo(&x.clone(), move || {
| ^^^^^^^^ help: remove this
|
note: this value is dropped without further use
--> $DIR/redundant_clone.rs:199:10
|
LL | foo(&x.clone(), move || {
| ^
error: aborting due to 15 previous errors

View file

@ -1,4 +1,3 @@
// edition:2018
// FIXME: run-rustfix waiting on multi-span suggestions
#![warn(clippy::ref_binding_to_reference)]

View file

@ -1,5 +1,5 @@
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:31:14
--> $DIR/ref_binding_to_reference.rs:30:14
|
LL | Some(ref x) => x,
| ^^^^^
@ -11,7 +11,7 @@ LL | Some(x) => &x,
| ~ ~~
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:37:14
--> $DIR/ref_binding_to_reference.rs:36:14
|
LL | Some(ref x) => {
| ^^^^^
@ -25,7 +25,7 @@ LL ~ &x
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:47:14
--> $DIR/ref_binding_to_reference.rs:46:14
|
LL | Some(ref x) => m2!(x),
| ^^^^^
@ -36,7 +36,7 @@ LL | Some(x) => m2!(&x),
| ~ ~~
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:52:15
--> $DIR/ref_binding_to_reference.rs:51:15
|
LL | let _ = |&ref x: &&String| {
| ^^^^^
@ -48,7 +48,7 @@ LL ~ let _: &&String = &x;
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:58:12
--> $DIR/ref_binding_to_reference.rs:57:12
|
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
| ^^^^^
@ -61,7 +61,7 @@ LL ~ x
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:65:11
--> $DIR/ref_binding_to_reference.rs:64:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^
@ -73,7 +73,7 @@ LL ~ let _: &&String = &x;
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:73:11
--> $DIR/ref_binding_to_reference.rs:72:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^

View file

@ -1,5 +1,3 @@
// edition:2018
#![warn(clippy::all, clippy::pedantic)]
#![allow(
clippy::missing_errors_doc,

View file

@ -1,5 +1,3 @@
// edition:2018
#![warn(clippy::all, clippy::pedantic)]
#![allow(
clippy::missing_errors_doc,

View file

@ -1,5 +1,5 @@
error: method `add` can be confused for the standard trait method `std::ops::Add::add`
--> $DIR/method_list_1.rs:26:5
--> $DIR/method_list_1.rs:24:5
|
LL | / pub fn add(self, other: T) -> T {
LL | | unimplemented!()
@ -10,7 +10,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Add` or choosing a less ambiguous method name
error: method `as_mut` can be confused for the standard trait method `std::convert::AsMut::as_mut`
--> $DIR/method_list_1.rs:30:5
--> $DIR/method_list_1.rs:28:5
|
LL | / pub fn as_mut(&mut self) -> &mut T {
LL | | unimplemented!()
@ -20,7 +20,7 @@ LL | | }
= help: consider implementing the trait `std::convert::AsMut` or choosing a less ambiguous method name
error: method `as_ref` can be confused for the standard trait method `std::convert::AsRef::as_ref`
--> $DIR/method_list_1.rs:34:5
--> $DIR/method_list_1.rs:32:5
|
LL | / pub fn as_ref(&self) -> &T {
LL | | unimplemented!()
@ -30,7 +30,7 @@ LL | | }
= help: consider implementing the trait `std::convert::AsRef` or choosing a less ambiguous method name
error: method `bitand` can be confused for the standard trait method `std::ops::BitAnd::bitand`
--> $DIR/method_list_1.rs:38:5
--> $DIR/method_list_1.rs:36:5
|
LL | / pub fn bitand(self, rhs: T) -> T {
LL | | unimplemented!()
@ -40,7 +40,7 @@ LL | | }
= help: consider implementing the trait `std::ops::BitAnd` or choosing a less ambiguous method name
error: method `bitor` can be confused for the standard trait method `std::ops::BitOr::bitor`
--> $DIR/method_list_1.rs:42:5
--> $DIR/method_list_1.rs:40:5
|
LL | / pub fn bitor(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -50,7 +50,7 @@ LL | | }
= help: consider implementing the trait `std::ops::BitOr` or choosing a less ambiguous method name
error: method `bitxor` can be confused for the standard trait method `std::ops::BitXor::bitxor`
--> $DIR/method_list_1.rs:46:5
--> $DIR/method_list_1.rs:44:5
|
LL | / pub fn bitxor(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -60,7 +60,7 @@ LL | | }
= help: consider implementing the trait `std::ops::BitXor` or choosing a less ambiguous method name
error: method `borrow` can be confused for the standard trait method `std::borrow::Borrow::borrow`
--> $DIR/method_list_1.rs:50:5
--> $DIR/method_list_1.rs:48:5
|
LL | / pub fn borrow(&self) -> &str {
LL | | unimplemented!()
@ -70,7 +70,7 @@ LL | | }
= help: consider implementing the trait `std::borrow::Borrow` or choosing a less ambiguous method name
error: method `borrow_mut` can be confused for the standard trait method `std::borrow::BorrowMut::borrow_mut`
--> $DIR/method_list_1.rs:54:5
--> $DIR/method_list_1.rs:52:5
|
LL | / pub fn borrow_mut(&mut self) -> &mut str {
LL | | unimplemented!()
@ -80,7 +80,7 @@ LL | | }
= help: consider implementing the trait `std::borrow::BorrowMut` or choosing a less ambiguous method name
error: method `clone` can be confused for the standard trait method `std::clone::Clone::clone`
--> $DIR/method_list_1.rs:58:5
--> $DIR/method_list_1.rs:56:5
|
LL | / pub fn clone(&self) -> Self {
LL | | unimplemented!()
@ -90,7 +90,7 @@ LL | | }
= help: consider implementing the trait `std::clone::Clone` or choosing a less ambiguous method name
error: method `cmp` can be confused for the standard trait method `std::cmp::Ord::cmp`
--> $DIR/method_list_1.rs:62:5
--> $DIR/method_list_1.rs:60:5
|
LL | / pub fn cmp(&self, other: &Self) -> Self {
LL | | unimplemented!()
@ -100,7 +100,7 @@ LL | | }
= help: consider implementing the trait `std::cmp::Ord` or choosing a less ambiguous method name
error: method `deref` can be confused for the standard trait method `std::ops::Deref::deref`
--> $DIR/method_list_1.rs:70:5
--> $DIR/method_list_1.rs:68:5
|
LL | / pub fn deref(&self) -> &Self {
LL | | unimplemented!()
@ -110,7 +110,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Deref` or choosing a less ambiguous method name
error: method `deref_mut` can be confused for the standard trait method `std::ops::DerefMut::deref_mut`
--> $DIR/method_list_1.rs:74:5
--> $DIR/method_list_1.rs:72:5
|
LL | / pub fn deref_mut(&mut self) -> &mut Self {
LL | | unimplemented!()
@ -120,7 +120,7 @@ LL | | }
= help: consider implementing the trait `std::ops::DerefMut` or choosing a less ambiguous method name
error: method `div` can be confused for the standard trait method `std::ops::Div::div`
--> $DIR/method_list_1.rs:78:5
--> $DIR/method_list_1.rs:76:5
|
LL | / pub fn div(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -130,7 +130,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Div` or choosing a less ambiguous method name
error: method `drop` can be confused for the standard trait method `std::ops::Drop::drop`
--> $DIR/method_list_1.rs:82:5
--> $DIR/method_list_1.rs:80:5
|
LL | / pub fn drop(&mut self) {
LL | | unimplemented!()

View file

@ -1,5 +1,3 @@
// edition:2018
#![warn(clippy::all, clippy::pedantic)]
#![allow(
clippy::missing_errors_doc,

View file

@ -1,5 +1,5 @@
error: method `eq` can be confused for the standard trait method `std::cmp::PartialEq::eq`
--> $DIR/method_list_2.rs:27:5
--> $DIR/method_list_2.rs:25:5
|
LL | / pub fn eq(&self, other: &Self) -> bool {
LL | | unimplemented!()
@ -10,7 +10,7 @@ LL | | }
= help: consider implementing the trait `std::cmp::PartialEq` or choosing a less ambiguous method name
error: method `from_iter` can be confused for the standard trait method `std::iter::FromIterator::from_iter`
--> $DIR/method_list_2.rs:31:5
--> $DIR/method_list_2.rs:29:5
|
LL | / pub fn from_iter<T>(iter: T) -> Self {
LL | | unimplemented!()
@ -20,7 +20,7 @@ LL | | }
= help: consider implementing the trait `std::iter::FromIterator` or choosing a less ambiguous method name
error: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
--> $DIR/method_list_2.rs:35:5
--> $DIR/method_list_2.rs:33:5
|
LL | / pub fn from_str(s: &str) -> Result<Self, Self> {
LL | | unimplemented!()
@ -30,7 +30,7 @@ LL | | }
= help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name
error: method `hash` can be confused for the standard trait method `std::hash::Hash::hash`
--> $DIR/method_list_2.rs:39:5
--> $DIR/method_list_2.rs:37:5
|
LL | / pub fn hash(&self, state: &mut T) {
LL | | unimplemented!()
@ -40,7 +40,7 @@ LL | | }
= help: consider implementing the trait `std::hash::Hash` or choosing a less ambiguous method name
error: method `index` can be confused for the standard trait method `std::ops::Index::index`
--> $DIR/method_list_2.rs:43:5
--> $DIR/method_list_2.rs:41:5
|
LL | / pub fn index(&self, index: usize) -> &Self {
LL | | unimplemented!()
@ -50,7 +50,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Index` or choosing a less ambiguous method name
error: method `index_mut` can be confused for the standard trait method `std::ops::IndexMut::index_mut`
--> $DIR/method_list_2.rs:47:5
--> $DIR/method_list_2.rs:45:5
|
LL | / pub fn index_mut(&mut self, index: usize) -> &mut Self {
LL | | unimplemented!()
@ -60,7 +60,7 @@ LL | | }
= help: consider implementing the trait `std::ops::IndexMut` or choosing a less ambiguous method name
error: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
--> $DIR/method_list_2.rs:51:5
--> $DIR/method_list_2.rs:49:5
|
LL | / pub fn into_iter(self) -> Self {
LL | | unimplemented!()
@ -70,7 +70,7 @@ LL | | }
= help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name
error: method `mul` can be confused for the standard trait method `std::ops::Mul::mul`
--> $DIR/method_list_2.rs:55:5
--> $DIR/method_list_2.rs:53:5
|
LL | / pub fn mul(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -80,7 +80,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Mul` or choosing a less ambiguous method name
error: method `neg` can be confused for the standard trait method `std::ops::Neg::neg`
--> $DIR/method_list_2.rs:59:5
--> $DIR/method_list_2.rs:57:5
|
LL | / pub fn neg(self) -> Self {
LL | | unimplemented!()
@ -90,7 +90,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Neg` or choosing a less ambiguous method name
error: method `next` can be confused for the standard trait method `std::iter::Iterator::next`
--> $DIR/method_list_2.rs:63:5
--> $DIR/method_list_2.rs:61:5
|
LL | / pub fn next(&mut self) -> Option<Self> {
LL | | unimplemented!()
@ -100,7 +100,7 @@ LL | | }
= help: consider implementing the trait `std::iter::Iterator` or choosing a less ambiguous method name
error: method `not` can be confused for the standard trait method `std::ops::Not::not`
--> $DIR/method_list_2.rs:67:5
--> $DIR/method_list_2.rs:65:5
|
LL | / pub fn not(self) -> Self {
LL | | unimplemented!()
@ -110,7 +110,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Not` or choosing a less ambiguous method name
error: method `rem` can be confused for the standard trait method `std::ops::Rem::rem`
--> $DIR/method_list_2.rs:71:5
--> $DIR/method_list_2.rs:69:5
|
LL | / pub fn rem(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -120,7 +120,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Rem` or choosing a less ambiguous method name
error: method `shl` can be confused for the standard trait method `std::ops::Shl::shl`
--> $DIR/method_list_2.rs:75:5
--> $DIR/method_list_2.rs:73:5
|
LL | / pub fn shl(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -130,7 +130,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Shl` or choosing a less ambiguous method name
error: method `shr` can be confused for the standard trait method `std::ops::Shr::shr`
--> $DIR/method_list_2.rs:79:5
--> $DIR/method_list_2.rs:77:5
|
LL | / pub fn shr(self, rhs: Self) -> Self {
LL | | unimplemented!()
@ -140,7 +140,7 @@ LL | | }
= help: consider implementing the trait `std::ops::Shr` or choosing a less ambiguous method name
error: method `sub` can be confused for the standard trait method `std::ops::Sub::sub`
--> $DIR/method_list_2.rs:83:5
--> $DIR/method_list_2.rs:81:5
|
LL | / pub fn sub(self, rhs: Self) -> Self {
LL | | unimplemented!()

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,5 +1,5 @@
error: this import is redundant
--> $DIR/single_component_path_imports.rs:24:5
--> $DIR/single_component_path_imports.rs:23:5
|
LL | use regex;
| ^^^^^^^^^^ help: remove it entirely
@ -7,7 +7,7 @@ LL | use regex;
= note: `-D clippy::single-component-path-imports` implied by `-D warnings`
error: this import is redundant
--> $DIR/single_component_path_imports.rs:6:1
--> $DIR/single_component_path_imports.rs:5:1
|
LL | use regex;
| ^^^^^^^^^^ help: remove it entirely

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,5 +1,5 @@
error: this import is redundant
--> $DIR/single_component_path_imports_macro.rs:16:1
--> $DIR/single_component_path_imports_macro.rs:15:1
|
LL | use m2; // fail
| ^^^^^^^ help: remove it entirely

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,5 +1,5 @@
error: this import is redundant
--> $DIR/single_component_path_imports_nested_first.rs:14:10
--> $DIR/single_component_path_imports_nested_first.rs:13:10
|
LL | use {regex, serde};
| ^^^^^
@ -8,7 +8,7 @@ LL | use {regex, serde};
= help: remove this import
error: this import is redundant
--> $DIR/single_component_path_imports_nested_first.rs:14:17
--> $DIR/single_component_path_imports_nested_first.rs:13:17
|
LL | use {regex, serde};
| ^^^^^
@ -16,7 +16,7 @@ LL | use {regex, serde};
= help: remove this import
error: this import is redundant
--> $DIR/single_component_path_imports_nested_first.rs:5:1
--> $DIR/single_component_path_imports_nested_first.rs:4:1
|
LL | use regex;
| ^^^^^^^^^^ help: remove it entirely

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

View file

@ -1,4 +1,3 @@
// edition:2018
#![warn(clippy::unused_async)]
async fn foo() -> i32 {

View file

@ -1,5 +1,5 @@
error: unused `async` for function with no await statements
--> $DIR/unused_async.rs:4:1
--> $DIR/unused_async.rs:3:1
|
LL | / async fn foo() -> i32 {
LL | | 4

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
// aux-build:proc_macro_derive.rs
#![warn(clippy::use_self)]

View file

@ -1,5 +1,4 @@
// run-rustfix
// edition:2018
// aux-build:proc_macro_derive.rs
#![warn(clippy::use_self)]

View file

@ -1,5 +1,5 @@
error: unnecessary structure name repetition
--> $DIR/use_self.rs:23:21
--> $DIR/use_self.rs:22:21
|
LL | fn new() -> Foo {
| ^^^ help: use the applicable keyword: `Self`
@ -7,163 +7,163 @@ LL | fn new() -> Foo {
= note: `-D clippy::use-self` implied by `-D warnings`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:24:13
--> $DIR/use_self.rs:23:13
|
LL | Foo {}
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:26:22
--> $DIR/use_self.rs:25:22
|
LL | fn test() -> Foo {
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:27:13
--> $DIR/use_self.rs:26:13
|
LL | Foo::new()
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:32:25
--> $DIR/use_self.rs:31:25
|
LL | fn default() -> Foo {
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:33:13
--> $DIR/use_self.rs:32:13
|
LL | Foo::new()
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:98:24
--> $DIR/use_self.rs:97:24
|
LL | fn bad(foos: &[Foo]) -> impl Iterator<Item = &Foo> {
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:98:55
--> $DIR/use_self.rs:97:55
|
LL | fn bad(foos: &[Foo]) -> impl Iterator<Item = &Foo> {
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:113:13
--> $DIR/use_self.rs:112:13
|
LL | TS(0)
| ^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:148:29
--> $DIR/use_self.rs:147:29
|
LL | fn bar() -> Bar {
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:149:21
--> $DIR/use_self.rs:148:21
|
LL | Bar { foo: Foo {} }
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:160:21
--> $DIR/use_self.rs:159:21
|
LL | fn baz() -> Foo {
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:161:13
--> $DIR/use_self.rs:160:13
|
LL | Foo {}
| ^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:178:21
--> $DIR/use_self.rs:177:21
|
LL | let _ = Enum::B(42);
| ^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:179:21
--> $DIR/use_self.rs:178:21
|
LL | let _ = Enum::C { field: true };
| ^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:180:21
--> $DIR/use_self.rs:179:21
|
LL | let _ = Enum::A;
| ^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:222:13
--> $DIR/use_self.rs:221:13
|
LL | nested::A::fun_1();
| ^^^^^^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:223:13
--> $DIR/use_self.rs:222:13
|
LL | nested::A::A;
| ^^^^^^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:225:13
--> $DIR/use_self.rs:224:13
|
LL | nested::A {};
| ^^^^^^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:244:13
--> $DIR/use_self.rs:243:13
|
LL | TestStruct::from_something()
| ^^^^^^^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:258:25
--> $DIR/use_self.rs:257:25
|
LL | async fn g() -> S {
| ^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:259:13
--> $DIR/use_self.rs:258:13
|
LL | S {}
| ^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:263:16
--> $DIR/use_self.rs:262:16
|
LL | &p[S::A..S::B]
| ^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:263:22
--> $DIR/use_self.rs:262:22
|
LL | &p[S::A..S::B]
| ^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:286:29
--> $DIR/use_self.rs:285:29
|
LL | fn foo(value: T) -> Foo<T> {
| ^^^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:287:13
--> $DIR/use_self.rs:286:13
|
LL | Foo::<T> { value }
| ^^^^^^^^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:459:13
--> $DIR/use_self.rs:458:13
|
LL | A::new::<submod::B>(submod::B {})
| ^ help: use the applicable keyword: `Self`
error: unnecessary structure name repetition
--> $DIR/use_self.rs:496:13
--> $DIR/use_self.rs:495:13
|
LL | S2::new()
| ^^ help: use the applicable keyword: `Self`

View file

@ -1,4 +1,3 @@
// edition:2018
// aux-build:proc_macro_derive.rs
#![feature(rustc_private)]

View file

@ -1,5 +1,5 @@
error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:26:5
--> $DIR/used_underscore_binding.rs:25:5
|
LL | _foo + 1
| ^^^^
@ -7,31 +7,31 @@ LL | _foo + 1
= note: `-D clippy::used-underscore-binding` implied by `-D warnings`
error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:31:20
--> $DIR/used_underscore_binding.rs:30:20
|
LL | println!("{}", _foo);
| ^^^^
error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:32:16
--> $DIR/used_underscore_binding.rs:31:16
|
LL | assert_eq!(_foo, _foo);
| ^^^^
error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:32:22
--> $DIR/used_underscore_binding.rs:31:22
|
LL | assert_eq!(_foo, _foo);
| ^^^^
error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:45:5
--> $DIR/used_underscore_binding.rs:44:5
|
LL | s._underscore_field += 1;
| ^^^^^^^^^^^^^^^^^^^
error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:100:16
--> $DIR/used_underscore_binding.rs:99:16
|
LL | uses_i(_i);
| ^^

Some files were not shown because too many files have changed in this diff Show more