mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
Update other UI tests as well
This commit is contained in:
parent
8dfb3ec8a4
commit
2b35edbb84
9 changed files with 48 additions and 43 deletions
|
@ -1,4 +1,4 @@
|
|||
#![allow(dead_code, unused_variables)]
|
||||
#![allow(dead_code, unused_variables, clippy::return_self_not_must_use)]
|
||||
|
||||
/// Utility macro to test linting behavior in `option_methods()`
|
||||
/// The lints included in `option_methods()` should not lint if the call to map is partially
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// run-rustfix
|
||||
#![allow(clippy::return_self_not_must_use)]
|
||||
#![warn(clippy::deref_addrof)]
|
||||
|
||||
fn get_number() -> usize {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// run-rustfix
|
||||
#![allow(clippy::return_self_not_must_use)]
|
||||
#![warn(clippy::deref_addrof)]
|
||||
|
||||
fn get_number() -> usize {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:18:13
|
||||
--> $DIR/deref_addrof.rs:19:13
|
||||
|
|
||||
LL | let b = *&a;
|
||||
| ^^^ help: try this: `a`
|
||||
|
@ -7,49 +7,49 @@ LL | let b = *&a;
|
|||
= note: `-D clippy::deref-addrof` implied by `-D warnings`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:20:13
|
||||
--> $DIR/deref_addrof.rs:21:13
|
||||
|
|
||||
LL | let b = *&get_number();
|
||||
| ^^^^^^^^^^^^^^ help: try this: `get_number()`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:25:13
|
||||
--> $DIR/deref_addrof.rs:26:13
|
||||
|
|
||||
LL | let b = *&bytes[1..2][0];
|
||||
| ^^^^^^^^^^^^^^^^ help: try this: `bytes[1..2][0]`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:29:13
|
||||
--> $DIR/deref_addrof.rs:30:13
|
||||
|
|
||||
LL | let b = *&(a);
|
||||
| ^^^^^ help: try this: `(a)`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:31:13
|
||||
--> $DIR/deref_addrof.rs:32:13
|
||||
|
|
||||
LL | let b = *(&a);
|
||||
| ^^^^^ help: try this: `a`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:34:13
|
||||
--> $DIR/deref_addrof.rs:35:13
|
||||
|
|
||||
LL | let b = *((&a));
|
||||
| ^^^^^^^ help: try this: `a`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:36:13
|
||||
--> $DIR/deref_addrof.rs:37:13
|
||||
|
|
||||
LL | let b = *&&a;
|
||||
| ^^^^ help: try this: `&a`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:38:14
|
||||
--> $DIR/deref_addrof.rs:39:14
|
||||
|
|
||||
LL | let b = **&aref;
|
||||
| ^^^^^^ help: try this: `aref`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:44:9
|
||||
--> $DIR/deref_addrof.rs:45:9
|
||||
|
|
||||
LL | *& $visitor
|
||||
| ^^^^^^^^^^^ help: try this: `$visitor`
|
||||
|
@ -60,7 +60,7 @@ LL | m!(self)
|
|||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> $DIR/deref_addrof.rs:51:9
|
||||
--> $DIR/deref_addrof.rs:52:9
|
||||
|
|
||||
LL | *& mut $visitor
|
||||
| ^^^^^^^^^^^^^^^ help: try this: `$visitor`
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
clippy::needless_lifetimes,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::wrong_self_convention,
|
||||
clippy::missing_panics_doc
|
||||
clippy::missing_panics_doc,
|
||||
clippy::return_self_not_must_use
|
||||
)]
|
||||
|
||||
use std::ops::Mul;
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
clippy::needless_lifetimes,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::wrong_self_convention,
|
||||
clippy::missing_panics_doc
|
||||
clippy::missing_panics_doc,
|
||||
clippy::return_self_not_must_use
|
||||
)]
|
||||
|
||||
use std::ops::Mul;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: method `add` can be confused for the standard trait method `std::ops::Add::add`
|
||||
--> $DIR/method_list_1.rs:24:5
|
||||
--> $DIR/method_list_1.rs:25: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:28:5
|
||||
--> $DIR/method_list_1.rs:29: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:32:5
|
||||
--> $DIR/method_list_1.rs:33: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:36:5
|
||||
--> $DIR/method_list_1.rs:37: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:40:5
|
||||
--> $DIR/method_list_1.rs:41: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:44:5
|
||||
--> $DIR/method_list_1.rs:45: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:48:5
|
||||
--> $DIR/method_list_1.rs:49: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:52:5
|
||||
--> $DIR/method_list_1.rs:53: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:56:5
|
||||
--> $DIR/method_list_1.rs:57: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:60:5
|
||||
--> $DIR/method_list_1.rs:61: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:68:5
|
||||
--> $DIR/method_list_1.rs:69: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:72:5
|
||||
--> $DIR/method_list_1.rs:73: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:76:5
|
||||
--> $DIR/method_list_1.rs:77: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:80:5
|
||||
--> $DIR/method_list_1.rs:81:5
|
||||
|
|
||||
LL | / pub fn drop(&mut self) {
|
||||
LL | | unimplemented!()
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
clippy::needless_lifetimes,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::wrong_self_convention,
|
||||
clippy::missing_panics_doc
|
||||
clippy::missing_panics_doc,
|
||||
clippy::return_self_not_must_use
|
||||
)]
|
||||
|
||||
use std::ops::Mul;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: method `eq` can be confused for the standard trait method `std::cmp::PartialEq::eq`
|
||||
--> $DIR/method_list_2.rs:25:5
|
||||
--> $DIR/method_list_2.rs:26: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:29:5
|
||||
--> $DIR/method_list_2.rs:30: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:33:5
|
||||
--> $DIR/method_list_2.rs:34: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:37:5
|
||||
--> $DIR/method_list_2.rs:38: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:41:5
|
||||
--> $DIR/method_list_2.rs:42: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:45:5
|
||||
--> $DIR/method_list_2.rs:46: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:49:5
|
||||
--> $DIR/method_list_2.rs:50: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:53:5
|
||||
--> $DIR/method_list_2.rs:54: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:57:5
|
||||
--> $DIR/method_list_2.rs:58: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:61:5
|
||||
--> $DIR/method_list_2.rs:62: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:65:5
|
||||
--> $DIR/method_list_2.rs:66: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:69:5
|
||||
--> $DIR/method_list_2.rs:70: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:73:5
|
||||
--> $DIR/method_list_2.rs:74: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:77:5
|
||||
--> $DIR/method_list_2.rs:78: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:81:5
|
||||
--> $DIR/method_list_2.rs:82:5
|
||||
|
|
||||
LL | / pub fn sub(self, rhs: Self) -> Self {
|
||||
LL | | unimplemented!()
|
||||
|
|
Loading…
Reference in a new issue