Add imports_granularity = "Module" to rustfmt.toml
This commit is contained in:
parent
631faa1bc7
commit
2811effe34
279 changed files with 990 additions and 1055 deletions
|
|
@ -4,8 +4,7 @@
|
|||
#![allow(clippy::borrow_as_ptr, unused)]
|
||||
|
||||
extern crate proc_macros;
|
||||
use proc_macros::external;
|
||||
use proc_macros::with_span;
|
||||
use proc_macros::{external, with_span};
|
||||
|
||||
fn main() {
|
||||
let i = 0u32 as u64;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: using a potentially dangerous silent `as` conversion
|
||||
--> $DIR/as_conversions.rs:11:13
|
||||
--> $DIR/as_conversions.rs:10:13
|
||||
|
|
||||
LL | let i = 0u32 as u64;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
@ -8,7 +8,7 @@ LL | let i = 0u32 as u64;
|
|||
= note: `-D clippy::as-conversions` implied by `-D warnings`
|
||||
|
||||
error: using a potentially dangerous silent `as` conversion
|
||||
--> $DIR/as_conversions.rs:13:13
|
||||
--> $DIR/as_conversions.rs:12:13
|
||||
|
|
||||
LL | let j = &i as *const u64 as *mut u64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -16,7 +16,7 @@ LL | let j = &i as *const u64 as *mut u64;
|
|||
= help: consider using a safe wrapper for this conversion
|
||||
|
||||
error: using a potentially dangerous silent `as` conversion
|
||||
--> $DIR/as_conversions.rs:13:13
|
||||
--> $DIR/as_conversions.rs:12:13
|
||||
|
|
||||
LL | let j = &i as *const u64 as *mut u64;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ pub mod inner {
|
|||
|
||||
// RE-EXPORT
|
||||
// this will stick in `inner` module
|
||||
pub use macro_rules::mut_mut;
|
||||
pub use macro_rules::try_err;
|
||||
pub use macro_rules::{mut_mut, try_err};
|
||||
|
||||
pub mod nested {
|
||||
pub use macro_rules::string_add;
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ extern crate syn;
|
|||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::{quote, quote_spanned};
|
||||
use syn::parse_macro_input;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::token::Star;
|
||||
use syn::{
|
||||
parse_quote, FnArg, ImplItem, ItemImpl, ItemTrait, Lifetime, Pat, PatIdent, PatType, Signature, TraitItem, Type,
|
||||
parse_macro_input, parse_quote, FnArg, ImplItem, ItemImpl, ItemTrait, Lifetime, Pat, PatIdent, PatType, Signature,
|
||||
TraitItem, Type,
|
||||
};
|
||||
|
||||
#[proc_macro_attribute]
|
||||
|
|
|
|||
|
|
@ -5,13 +5,10 @@
|
|||
extern crate proc_macro;
|
||||
|
||||
use core::mem;
|
||||
use proc_macro::{
|
||||
token_stream::IntoIter,
|
||||
Delimiter::{self, Brace, Parenthesis},
|
||||
Group, Ident, Literal, Punct,
|
||||
Spacing::{self, Alone, Joint},
|
||||
Span, TokenStream, TokenTree as TT,
|
||||
};
|
||||
use proc_macro::token_stream::IntoIter;
|
||||
use proc_macro::Delimiter::{self, Brace, Parenthesis};
|
||||
use proc_macro::Spacing::{self, Alone, Joint};
|
||||
use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree as TT};
|
||||
|
||||
type Result<T> = core::result::Result<T, TokenStream>;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@
|
|||
extern crate proc_macros;
|
||||
|
||||
use proc_macros::with_span;
|
||||
use std::default;
|
||||
use std::default::Default as D2;
|
||||
use std::string;
|
||||
use std::{default, string};
|
||||
|
||||
fn main() {
|
||||
let s1: String = String::default();
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@
|
|||
extern crate proc_macros;
|
||||
|
||||
use proc_macros::with_span;
|
||||
use std::default;
|
||||
use std::default::Default as D2;
|
||||
use std::string;
|
||||
use std::{default, string};
|
||||
|
||||
fn main() {
|
||||
let s1: String = Default::default();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: calling `String::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:15:22
|
||||
--> $DIR/default_trait_access.rs:14:22
|
||||
|
|
||||
LL | let s1: String = Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `String::default()`
|
||||
|
|
@ -11,43 +11,43 @@ LL | #![deny(clippy::default_trait_access)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: calling `String::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:19:22
|
||||
--> $DIR/default_trait_access.rs:18:22
|
||||
|
|
||||
LL | let s3: String = D2::default();
|
||||
| ^^^^^^^^^^^^^ help: try: `String::default()`
|
||||
|
||||
error: calling `String::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:21:22
|
||||
--> $DIR/default_trait_access.rs:20:22
|
||||
|
|
||||
LL | let s4: String = std::default::Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `String::default()`
|
||||
|
||||
error: calling `String::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:25:22
|
||||
--> $DIR/default_trait_access.rs:24:22
|
||||
|
|
||||
LL | let s6: String = default::Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `String::default()`
|
||||
|
||||
error: calling `GenericDerivedDefault::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:35:46
|
||||
--> $DIR/default_trait_access.rs:34:46
|
||||
|
|
||||
LL | let s11: GenericDerivedDefault<String> = Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault::default()`
|
||||
|
||||
error: calling `TupleDerivedDefault::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:41:36
|
||||
--> $DIR/default_trait_access.rs:40:36
|
||||
|
|
||||
LL | let s14: TupleDerivedDefault = Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()`
|
||||
|
||||
error: calling `ArrayDerivedDefault::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:43:36
|
||||
--> $DIR/default_trait_access.rs:42:36
|
||||
|
|
||||
LL | let s15: ArrayDerivedDefault = Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()`
|
||||
|
||||
error: calling `TupleStructDerivedDefault::default()` is more clear than this expression
|
||||
--> $DIR/default_trait_access.rs:47:42
|
||||
--> $DIR/default_trait_access.rs:46:42
|
||||
|
|
||||
LL | let s17: TupleStructDerivedDefault = Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleStructDerivedDefault::default()`
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::get_first)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
|
||||
struct Bar {
|
||||
arr: [u32; 3],
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::get_first)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
|
||||
struct Bar {
|
||||
arr: [u32; 3],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: accessing first element with `x.get(0)`
|
||||
--> $DIR/get_first.rs:20:13
|
||||
--> $DIR/get_first.rs:18:13
|
||||
|
|
||||
LL | let _ = x.get(0); // Use x.first()
|
||||
| ^^^^^^^^ help: try: `x.first()`
|
||||
|
|
@ -7,13 +7,13 @@ LL | let _ = x.get(0); // Use x.first()
|
|||
= note: `-D clippy::get-first` implied by `-D warnings`
|
||||
|
||||
error: accessing first element with `y.get(0)`
|
||||
--> $DIR/get_first.rs:25:13
|
||||
--> $DIR/get_first.rs:23:13
|
||||
|
|
||||
LL | let _ = y.get(0); // Use y.first()
|
||||
| ^^^^^^^^ help: try: `y.first()`
|
||||
|
||||
error: accessing first element with `z.get(0)`
|
||||
--> $DIR/get_first.rs:30:13
|
||||
--> $DIR/get_first.rs:28:13
|
||||
|
|
||||
LL | let _ = z.get(0); // Use z.first()
|
||||
| ^^^^^^^^ help: try: `z.first()`
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@
|
|||
#![warn(clippy::unwrap_used)]
|
||||
#![deny(clippy::get_unwrap)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
|
||||
struct GetFalsePositive {
|
||||
arr: [u32; 3],
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@
|
|||
#![warn(clippy::unwrap_used)]
|
||||
#![deny(clippy::get_unwrap)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
|
||||
struct GetFalsePositive {
|
||||
arr: [u32; 3],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
--> $DIR/get_unwrap.rs:38:17
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&boxed_slice[1]`
|
||||
|
|
@ -11,7 +11,7 @@ LL | #![deny(clippy::get_unwrap)]
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
--> $DIR/get_unwrap.rs:38:17
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -20,13 +20,13 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
|||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:41:17
|
||||
--> $DIR/get_unwrap.rs:39:17
|
||||
|
|
||||
LL | let _ = some_slice.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:41:17
|
||||
--> $DIR/get_unwrap.rs:39:17
|
||||
|
|
||||
LL | let _ = some_slice.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -34,13 +34,13 @@ LL | let _ = some_slice.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -48,13 +48,13 @@ LL | let _ = some_vec.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:43:17
|
||||
--> $DIR/get_unwrap.rs:41:17
|
||||
|
|
||||
LL | let _ = some_vecdeque.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:43:17
|
||||
--> $DIR/get_unwrap.rs:41:17
|
||||
|
|
||||
LL | let _ = some_vecdeque.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -62,13 +62,13 @@ LL | let _ = some_vecdeque.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:44:17
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
|
|
||||
LL | let _ = some_hashmap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_hashmap[&1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:44:17
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
|
|
||||
LL | let _ = some_hashmap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -76,13 +76,13 @@ LL | let _ = some_hashmap.get(&1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:45:17
|
||||
--> $DIR/get_unwrap.rs:43:17
|
||||
|
|
||||
LL | let _ = some_btreemap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&some_btreemap[&1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:45:17
|
||||
--> $DIR/get_unwrap.rs:43:17
|
||||
|
|
||||
LL | let _ = some_btreemap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -90,13 +90,13 @@ LL | let _ = some_btreemap.get(&1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:49:21
|
||||
--> $DIR/get_unwrap.rs:47:21
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice[1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:49:22
|
||||
--> $DIR/get_unwrap.rs:47:22
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -104,13 +104,13 @@ LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:54:9
|
||||
--> $DIR/get_unwrap.rs:52:9
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:54:10
|
||||
--> $DIR/get_unwrap.rs:52:10
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -118,13 +118,13 @@ LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:55:9
|
||||
--> $DIR/get_unwrap.rs:53:9
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:55:10
|
||||
--> $DIR/get_unwrap.rs:53:10
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -132,13 +132,13 @@ LL | *some_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:56:9
|
||||
--> $DIR/get_unwrap.rs:54:9
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:56:10
|
||||
--> $DIR/get_unwrap.rs:54:10
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -146,13 +146,13 @@ LL | *some_vec.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:57:9
|
||||
--> $DIR/get_unwrap.rs:55:9
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:57:10
|
||||
--> $DIR/get_unwrap.rs:55:10
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -160,13 +160,13 @@ LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:69:17
|
||||
--> $DIR/get_unwrap.rs:67:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:69:17
|
||||
--> $DIR/get_unwrap.rs:67:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -174,13 +174,13 @@ LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:70:17
|
||||
--> $DIR/get_unwrap.rs:68:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:70:17
|
||||
--> $DIR/get_unwrap.rs:68:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -188,25 +188,25 @@ LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:80:24
|
||||
--> $DIR/get_unwrap.rs:78:24
|
||||
|
|
||||
LL | let _x: &i32 = f.get(1 + 2).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `&f[1 + 2]`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:83:18
|
||||
--> $DIR/get_unwrap.rs:81:18
|
||||
|
|
||||
LL | let _x = f.get(1 + 2).unwrap().to_string();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `f[1 + 2]`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:86:18
|
||||
--> $DIR/get_unwrap.rs:84:18
|
||||
|
|
||||
LL | let _x = f.get(1 + 2).unwrap().abs();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `f[1 + 2]`
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:103:33
|
||||
--> $DIR/get_unwrap.rs:101:33
|
||||
|
|
||||
LL | let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut rest[linidx(j, k) - linidx(i, k) - 1]`
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
use std::{borrow::Cow, collections::BTreeMap, marker::PhantomData, sync::Arc};
|
||||
use std::borrow::Cow;
|
||||
use std::collections::BTreeMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
fn byte_view<'a>(s: &'a ByteView<'_>) -> BTreeMap<&'a str, ByteView<'a>> {
|
||||
panic!()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: sub-expression diverges
|
||||
--> $DIR/issue-7447.rs:23:15
|
||||
--> $DIR/issue-7447.rs:26:15
|
||||
|
|
||||
LL | byte_view(panic!());
|
||||
| ^^^^^^^^
|
||||
|
|
@ -8,7 +8,7 @@ LL | byte_view(panic!());
|
|||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: sub-expression diverges
|
||||
--> $DIR/issue-7447.rs:24:19
|
||||
--> $DIR/issue-7447.rs:27:19
|
||||
|
|
||||
LL | group_entries(panic!());
|
||||
| ^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
#![allow(unused)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
|
||||
fn main() {
|
||||
let v = [1, 2, 3, 4, 5];
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
#![allow(unused)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
|
||||
fn main() {
|
||||
let v = [1, 2, 3, 4, 5];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||||
--> $DIR/iter_cloned_collect.rs:11:27
|
||||
--> $DIR/iter_cloned_collect.rs:10:27
|
||||
|
|
||||
LL | let v2: Vec<isize> = v.iter().cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
|
||||
|
|
@ -7,13 +7,13 @@ LL | let v2: Vec<isize> = v.iter().cloned().collect();
|
|||
= note: `-D clippy::iter-cloned-collect` implied by `-D warnings`
|
||||
|
||||
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||||
--> $DIR/iter_cloned_collect.rs:16:38
|
||||
--> $DIR/iter_cloned_collect.rs:15:38
|
||||
|
|
||||
LL | let _: Vec<isize> = vec![1, 2, 3].iter().cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
|
||||
|
||||
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||||
--> $DIR/iter_cloned_collect.rs:21:24
|
||||
--> $DIR/iter_cloned_collect.rs:20:24
|
||||
|
|
||||
LL | .to_bytes()
|
||||
| ________________________^
|
||||
|
|
@ -23,13 +23,13 @@ LL | | .collect();
|
|||
| |______________________^ help: try: `.to_vec()`
|
||||
|
||||
error: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||||
--> $DIR/iter_cloned_collect.rs:29:24
|
||||
--> $DIR/iter_cloned_collect.rs:28:24
|
||||
|
|
||||
LL | let _: Vec<_> = arr.iter().cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
|
||||
|
||||
error: called `iter().copied().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
||||
--> $DIR/iter_cloned_collect.rs:32:26
|
||||
--> $DIR/iter_cloned_collect.rs:31:26
|
||||
|
|
||||
LL | let _: Vec<isize> = v.iter().copied().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()`
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
extern crate parking_lot;
|
||||
|
||||
fn main() {
|
||||
use parking_lot::{lock_api::RawMutex, Mutex, RwLock};
|
||||
use parking_lot::lock_api::RawMutex;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
|
||||
let p_m: Mutex<()> = Mutex::const_new(RawMutex::INIT, ());
|
||||
let _ = p_m.lock();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: non-binding `let` on a synchronization lock
|
||||
--> $DIR/let_underscore_lock.rs:9:5
|
||||
--> $DIR/let_underscore_lock.rs:10:5
|
||||
|
|
||||
LL | let _ = p_m.lock();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -8,7 +8,7 @@ LL | let _ = p_m.lock();
|
|||
= note: `-D clippy::let-underscore-lock` implied by `-D warnings`
|
||||
|
||||
error: non-binding `let` on a synchronization lock
|
||||
--> $DIR/let_underscore_lock.rs:12:5
|
||||
--> $DIR/let_underscore_lock.rs:13:5
|
||||
|
|
||||
LL | let _ = p_m1.lock();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -16,7 +16,7 @@ LL | let _ = p_m1.lock();
|
|||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: non-binding `let` on a synchronization lock
|
||||
--> $DIR/let_underscore_lock.rs:15:5
|
||||
--> $DIR/let_underscore_lock.rs:16:5
|
||||
|
|
||||
LL | let _ = p_rw.read();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -24,7 +24,7 @@ LL | let _ = p_rw.read();
|
|||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: non-binding `let` on a synchronization lock
|
||||
--> $DIR/let_underscore_lock.rs:16:5
|
||||
--> $DIR/let_underscore_lock.rs:17:5
|
||||
|
|
||||
LL | let _ = p_rw.write();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ extern crate proc_macros;
|
|||
use proc_macros::with_span;
|
||||
|
||||
use clippy_utils::is_from_proc_macro;
|
||||
use std::boxed::Box;
|
||||
use std::fmt::Display;
|
||||
use std::future::Future;
|
||||
use std::{boxed::Box, fmt::Display};
|
||||
|
||||
fn a() -> u32 {
|
||||
1
|
||||
|
|
|
|||
|
|
@ -1,60 +1,60 @@
|
|||
error: non-binding `let` without a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:50:5
|
||||
--> $DIR/let_underscore_untyped.rs:51:5
|
||||
|
|
||||
LL | let _ = a();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: consider adding a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:50:10
|
||||
--> $DIR/let_underscore_untyped.rs:51:10
|
||||
|
|
||||
LL | let _ = a();
|
||||
| ^
|
||||
= note: `-D clippy::let-underscore-untyped` implied by `-D warnings`
|
||||
|
||||
error: non-binding `let` without a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:51:5
|
||||
--> $DIR/let_underscore_untyped.rs:52:5
|
||||
|
|
||||
LL | let _ = b(1);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider adding a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:51:10
|
||||
--> $DIR/let_underscore_untyped.rs:52:10
|
||||
|
|
||||
LL | let _ = b(1);
|
||||
| ^
|
||||
|
||||
error: non-binding `let` without a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:53:5
|
||||
--> $DIR/let_underscore_untyped.rs:54:5
|
||||
|
|
||||
LL | let _ = d(&1);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider adding a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:53:10
|
||||
--> $DIR/let_underscore_untyped.rs:54:10
|
||||
|
|
||||
LL | let _ = d(&1);
|
||||
| ^
|
||||
|
||||
error: non-binding `let` without a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:54:5
|
||||
--> $DIR/let_underscore_untyped.rs:55:5
|
||||
|
|
||||
LL | let _ = e();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: consider adding a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:54:10
|
||||
--> $DIR/let_underscore_untyped.rs:55:10
|
||||
|
|
||||
LL | let _ = e();
|
||||
| ^
|
||||
|
||||
error: non-binding `let` without a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:55:5
|
||||
--> $DIR/let_underscore_untyped.rs:56:5
|
||||
|
|
||||
LL | let _ = f();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: consider adding a type annotation
|
||||
--> $DIR/let_underscore_untyped.rs:55:10
|
||||
--> $DIR/let_underscore_untyped.rs:56:10
|
||||
|
|
||||
LL | let _ = f();
|
||||
| ^
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::manual_retain)]
|
||||
#![allow(unused, clippy::redundant_clone)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::BTreeSet;
|
||||
use std::collections::BinaryHeap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
|
||||
|
||||
fn main() {
|
||||
binary_heap_retain();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::manual_retain)]
|
||||
#![allow(unused, clippy::redundant_clone)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::BTreeSet;
|
||||
use std::collections::BinaryHeap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
|
||||
|
||||
fn main() {
|
||||
binary_heap_retain();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:51:5
|
||||
--> $DIR/manual_retain.rs:46:5
|
||||
|
|
||||
LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|k, _| k % 2 == 0)`
|
||||
|
|
@ -7,13 +7,13 @@ LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect()
|
|||
= note: `-D clippy::manual-retain` implied by `-D warnings`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:52:5
|
||||
--> $DIR/manual_retain.rs:47:5
|
||||
|
|
||||
LL | btree_map = btree_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|_, &mut v| v % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:53:5
|
||||
--> $DIR/manual_retain.rs:48:5
|
||||
|
|
||||
LL | / btree_map = btree_map
|
||||
LL | | .into_iter()
|
||||
|
|
@ -22,37 +22,37 @@ LL | | .collect();
|
|||
| |__________________^ help: consider calling `.retain()` instead: `btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:75:5
|
||||
--> $DIR/manual_retain.rs:70:5
|
||||
|
|
||||
LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).copied().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:76:5
|
||||
--> $DIR/manual_retain.rs:71:5
|
||||
|
|
||||
LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:77:5
|
||||
--> $DIR/manual_retain.rs:72:5
|
||||
|
|
||||
LL | btree_set = btree_set.into_iter().filter(|x| x % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:107:5
|
||||
--> $DIR/manual_retain.rs:102:5
|
||||
|
|
||||
LL | hash_map = hash_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|k, _| k % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:108:5
|
||||
--> $DIR/manual_retain.rs:103:5
|
||||
|
|
||||
LL | hash_map = hash_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|_, &mut v| v % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:109:5
|
||||
--> $DIR/manual_retain.rs:104:5
|
||||
|
|
||||
LL | / hash_map = hash_map
|
||||
LL | | .into_iter()
|
||||
|
|
@ -61,61 +61,61 @@ LL | | .collect();
|
|||
| |__________________^ help: consider calling `.retain()` instead: `hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:130:5
|
||||
--> $DIR/manual_retain.rs:125:5
|
||||
|
|
||||
LL | hash_set = hash_set.into_iter().filter(|x| x % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:131:5
|
||||
--> $DIR/manual_retain.rs:126:5
|
||||
|
|
||||
LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).copied().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:132:5
|
||||
--> $DIR/manual_retain.rs:127:5
|
||||
|
|
||||
LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:161:5
|
||||
--> $DIR/manual_retain.rs:156:5
|
||||
|
|
||||
LL | s = s.chars().filter(|&c| c != 'o').to_owned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `s.retain(|c| c != 'o')`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:173:5
|
||||
--> $DIR/manual_retain.rs:168:5
|
||||
|
|
||||
LL | vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:174:5
|
||||
--> $DIR/manual_retain.rs:169:5
|
||||
|
|
||||
LL | vec = vec.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:175:5
|
||||
--> $DIR/manual_retain.rs:170:5
|
||||
|
|
||||
LL | vec = vec.into_iter().filter(|x| x % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:197:5
|
||||
--> $DIR/manual_retain.rs:192:5
|
||||
|
|
||||
LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).copied().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:198:5
|
||||
--> $DIR/manual_retain.rs:193:5
|
||||
|
|
||||
LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
|
||||
|
||||
error: this expression can be written more simply using `.retain()`
|
||||
--> $DIR/manual_retain.rs:199:5
|
||||
--> $DIR/manual_retain.rs:194:5
|
||||
|
|
||||
LL | vec_deque = vec_deque.into_iter().filter(|x| x % 2 == 0).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
#![warn(clippy::manual_try_fold)]
|
||||
#![feature(try_trait_v2)]
|
||||
|
||||
use std::ops::ControlFlow;
|
||||
use std::ops::FromResidual;
|
||||
use std::ops::Try;
|
||||
use std::ops::{ControlFlow, FromResidual, Try};
|
||||
|
||||
#[macro_use]
|
||||
extern crate proc_macros;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: usage of `Iterator::fold` on a type that implements `Try`
|
||||
--> $DIR/manual_try_fold.rs:61:10
|
||||
--> $DIR/manual_try_fold.rs:59:10
|
||||
|
|
||||
LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)`
|
||||
|
|
@ -7,19 +7,19 @@ LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i))
|
|||
= note: `-D clippy::manual-try-fold` implied by `-D warnings`
|
||||
|
||||
error: usage of `Iterator::fold` on a type that implements `Try`
|
||||
--> $DIR/manual_try_fold.rs:65:10
|
||||
--> $DIR/manual_try_fold.rs:63:10
|
||||
|
|
||||
LL | .fold(NotOption(0i32, 0i32), |sum, i| NotOption(0i32, 0i32));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(..., |sum, i| ...)`
|
||||
|
||||
error: usage of `Iterator::fold` on a type that implements `Try`
|
||||
--> $DIR/manual_try_fold.rs:68:10
|
||||
--> $DIR/manual_try_fold.rs:66:10
|
||||
|
|
||||
LL | .fold(NotOptionButWorse(0i32), |sum, i| NotOptionButWorse(0i32));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)`
|
||||
|
||||
error: usage of `Iterator::fold` on a type that implements `Try`
|
||||
--> $DIR/manual_try_fold.rs:98:10
|
||||
--> $DIR/manual_try_fold.rs:96:10
|
||||
|
|
||||
LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i| ...)`
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ fn match_as_ref() {
|
|||
}
|
||||
|
||||
mod issue4437 {
|
||||
use std::{error::Error, fmt, num::ParseIntError};
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::num::ParseIntError;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct E {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ fn match_as_ref() {
|
|||
}
|
||||
|
||||
mod issue4437 {
|
||||
use std::{error::Error, fmt, num::ParseIntError};
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::num::ParseIntError;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct E {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ LL | | };
|
|||
| |_____^ help: try: `mut_owned.as_mut()`
|
||||
|
||||
error: use `as_ref()` instead
|
||||
--> $DIR/match_as_ref.rs:30:13
|
||||
--> $DIR/match_as_ref.rs:32:13
|
||||
|
|
||||
LL | / match self.source {
|
||||
LL | | Some(ref s) => Some(s),
|
||||
|
|
|
|||
|
|
@ -25,10 +25,7 @@
|
|||
#[macro_use]
|
||||
extern crate option_helpers;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
|
||||
use std::ops::Mul;
|
||||
use std::rc::{self, Rc};
|
||||
use std::sync::{self, Arc};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: methods called `new` usually return `Self`
|
||||
--> $DIR/methods.rs:106:5
|
||||
--> $DIR/methods.rs:103: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:127:13
|
||||
--> $DIR/methods.rs:124:13
|
||||
|
|
||||
LL | let _ = v.iter().filter(|&x| {
|
||||
| _____________^
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
#![warn(clippy::min_ident_chars)]
|
||||
|
||||
extern crate proc_macros;
|
||||
use proc_macros::external;
|
||||
use proc_macros::with_span;
|
||||
use proc_macros::{external, with_span};
|
||||
|
||||
struct A {
|
||||
a: u32,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:9:8
|
||||
--> $DIR/min_ident_chars.rs:8:8
|
||||
|
|
||||
LL | struct A {
|
||||
| ^
|
||||
|
|
@ -7,169 +7,169 @@ LL | struct A {
|
|||
= note: `-D clippy::min-ident-chars` implied by `-D warnings`
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:10:5
|
||||
--> $DIR/min_ident_chars.rs:9:5
|
||||
|
|
||||
LL | a: u32,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:12:5
|
||||
--> $DIR/min_ident_chars.rs:11:5
|
||||
|
|
||||
LL | A: u32,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:13:5
|
||||
--> $DIR/min_ident_chars.rs:12:5
|
||||
|
|
||||
LL | I: u32,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:16:8
|
||||
--> $DIR/min_ident_chars.rs:15:8
|
||||
|
|
||||
LL | struct B(u32);
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:18:8
|
||||
--> $DIR/min_ident_chars.rs:17:8
|
||||
|
|
||||
LL | struct O {
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:19:5
|
||||
--> $DIR/min_ident_chars.rs:18:5
|
||||
|
|
||||
LL | o: u32,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:24:6
|
||||
--> $DIR/min_ident_chars.rs:23:6
|
||||
|
|
||||
LL | enum C {
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:25:5
|
||||
--> $DIR/min_ident_chars.rs:24:5
|
||||
|
|
||||
LL | D,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:26:5
|
||||
--> $DIR/min_ident_chars.rs:25:5
|
||||
|
|
||||
LL | E,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:27:5
|
||||
--> $DIR/min_ident_chars.rs:26:5
|
||||
|
|
||||
LL | F,
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:51:9
|
||||
--> $DIR/min_ident_chars.rs:50:9
|
||||
|
|
||||
LL | let h = 1;
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:52:9
|
||||
--> $DIR/min_ident_chars.rs:51:9
|
||||
|
|
||||
LL | let e = 2;
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:53:9
|
||||
--> $DIR/min_ident_chars.rs:52:9
|
||||
|
|
||||
LL | let l = 3;
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:54:9
|
||||
--> $DIR/min_ident_chars.rs:53:9
|
||||
|
|
||||
LL | let l = 4;
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:55:9
|
||||
--> $DIR/min_ident_chars.rs:54:9
|
||||
|
|
||||
LL | let o = 6;
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:59:10
|
||||
--> $DIR/min_ident_chars.rs:58:10
|
||||
|
|
||||
LL | let (h, o, w) = (1, 2, 3);
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:59:13
|
||||
--> $DIR/min_ident_chars.rs:58:13
|
||||
|
|
||||
LL | let (h, o, w) = (1, 2, 3);
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:60:10
|
||||
--> $DIR/min_ident_chars.rs:59:10
|
||||
|
|
||||
LL | for (a, (r, e)) in (0..1000).enumerate().enumerate() {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:60:14
|
||||
--> $DIR/min_ident_chars.rs:59:14
|
||||
|
|
||||
LL | for (a, (r, e)) in (0..1000).enumerate().enumerate() {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:60:17
|
||||
--> $DIR/min_ident_chars.rs:59:17
|
||||
|
|
||||
LL | for (a, (r, e)) in (0..1000).enumerate().enumerate() {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:62:16
|
||||
--> $DIR/min_ident_chars.rs:61:16
|
||||
|
|
||||
LL | while let (d, o, _i, n, g) = (true, true, false, false, true) {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:62:19
|
||||
--> $DIR/min_ident_chars.rs:61:19
|
||||
|
|
||||
LL | while let (d, o, _i, n, g) = (true, true, false, false, true) {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:62:29
|
||||
--> $DIR/min_ident_chars.rs:61:29
|
||||
|
|
||||
LL | while let (d, o, _i, n, g) = (true, true, false, false, true) {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:66:9
|
||||
--> $DIR/min_ident_chars.rs:65:9
|
||||
|
|
||||
LL | let o = 1;
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:67:9
|
||||
--> $DIR/min_ident_chars.rs:66:9
|
||||
|
|
||||
LL | let o = O { o };
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:81:4
|
||||
--> $DIR/min_ident_chars.rs:80:4
|
||||
|
|
||||
LL | fn b() {}
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:82:21
|
||||
--> $DIR/min_ident_chars.rs:81:21
|
||||
|
|
||||
LL | fn wrong_pythagoras(a: f32, b: f32) -> f32 {
|
||||
| ^
|
||||
|
||||
error: this ident consists of a single char
|
||||
--> $DIR/min_ident_chars.rs:82:29
|
||||
--> $DIR/min_ident_chars.rs:81:29
|
||||
|
|
||||
LL | fn wrong_pythagoras(a: f32, b: f32) -> f32 {
|
||||
| ^
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#![warn(clippy::all)]
|
||||
#![allow(clippy::manual_clamp)]
|
||||
|
||||
use std::cmp::max as my_max;
|
||||
use std::cmp::min as my_min;
|
||||
use std::cmp::{max, min};
|
||||
use std::cmp::{max as my_max, max, min as my_min, min};
|
||||
|
||||
const LARGE: usize = 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:24:5
|
||||
--> $DIR/min_max.rs:22:5
|
||||
|
|
||||
LL | min(1, max(3, x));
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -7,73 +7,73 @@ LL | min(1, max(3, x));
|
|||
= note: `-D clippy::min-max` implied by `-D warnings`
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:25:5
|
||||
--> $DIR/min_max.rs:23:5
|
||||
|
|
||||
LL | min(max(3, x), 1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:26:5
|
||||
--> $DIR/min_max.rs:24:5
|
||||
|
|
||||
LL | max(min(x, 1), 3);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:27:5
|
||||
--> $DIR/min_max.rs:25:5
|
||||
|
|
||||
LL | max(3, min(x, 1));
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:29:5
|
||||
--> $DIR/min_max.rs:27:5
|
||||
|
|
||||
LL | my_max(3, my_min(x, 1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:39:5
|
||||
--> $DIR/min_max.rs:37:5
|
||||
|
|
||||
LL | min("Apple", max("Zoo", s));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:40:5
|
||||
--> $DIR/min_max.rs:38:5
|
||||
|
|
||||
LL | max(min(s, "Apple"), "Zoo");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:45:5
|
||||
--> $DIR/min_max.rs:43:5
|
||||
|
|
||||
LL | x.min(1).max(3);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:46:5
|
||||
--> $DIR/min_max.rs:44:5
|
||||
|
|
||||
LL | x.max(3).min(1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:47:5
|
||||
--> $DIR/min_max.rs:45:5
|
||||
|
|
||||
LL | f.max(3f32).min(1f32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:53:5
|
||||
--> $DIR/min_max.rs:51:5
|
||||
|
|
||||
LL | max(x.min(1), 3);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:56:5
|
||||
--> $DIR/min_max.rs:54:5
|
||||
|
|
||||
LL | s.max("Zoo").min("Apple");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `min`/`max` combination leads to constant result
|
||||
--> $DIR/min_max.rs:57:5
|
||||
--> $DIR/min_max.rs:55:5
|
||||
|
|
||||
LL | s.min("Apple").max("Zoo");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -96,10 +96,8 @@ mod internal_impl {
|
|||
}
|
||||
/// dox
|
||||
pub mod public_interface {
|
||||
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};
|
||||
pub use crate::internal_impl::{documented as foo, documented, undocumented1 as bar, undocumented2};
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ use std::cell::Cell;
|
|||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::rc::Rc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
use std::sync::Arc;
|
||||
|
||||
struct Key(AtomicUsize);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:30:32
|
||||
--> $DIR/mut_key.rs:31:32
|
||||
|
|
||||
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -7,13 +7,13 @@ LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> Hash
|
|||
= note: `-D clippy::mutable-key-type` implied by `-D warnings`
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:30:72
|
||||
--> $DIR/mut_key.rs:31:72
|
||||
|
|
||||
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/mut_key.rs:30:32
|
||||
--> $DIR/mut_key.rs:31:32
|
||||
|
|
||||
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&HashMap<Key, usize>`
|
||||
|
|
@ -21,91 +21,91 @@ LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> Hash
|
|||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:31:5
|
||||
--> $DIR/mut_key.rs:32:5
|
||||
|
|
||||
LL | let _other: HashMap<Key, bool> = HashMap::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:58:22
|
||||
--> $DIR/mut_key.rs:59:22
|
||||
|
|
||||
LL | fn tuples_bad<U>(_m: &mut HashMap<(Key, U), bool>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:70:5
|
||||
--> $DIR/mut_key.rs:71:5
|
||||
|
|
||||
LL | let _map = HashMap::<Cell<usize>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:71:5
|
||||
--> $DIR/mut_key.rs:72:5
|
||||
|
|
||||
LL | let _map = HashMap::<&mut Cell<usize>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:72:5
|
||||
--> $DIR/mut_key.rs:73:5
|
||||
|
|
||||
LL | let _map = HashMap::<&mut usize, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:74:5
|
||||
--> $DIR/mut_key.rs:75:5
|
||||
|
|
||||
LL | let _map = HashMap::<Vec<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:75:5
|
||||
--> $DIR/mut_key.rs:76:5
|
||||
|
|
||||
LL | let _map = HashMap::<BTreeMap<Cell<usize>, ()>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:76:5
|
||||
--> $DIR/mut_key.rs:77:5
|
||||
|
|
||||
LL | let _map = HashMap::<BTreeMap<(), Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:77:5
|
||||
--> $DIR/mut_key.rs:78:5
|
||||
|
|
||||
LL | let _map = HashMap::<BTreeSet<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:78:5
|
||||
--> $DIR/mut_key.rs:79:5
|
||||
|
|
||||
LL | let _map = HashMap::<Option<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:79:5
|
||||
--> $DIR/mut_key.rs:80:5
|
||||
|
|
||||
LL | let _map = HashMap::<Option<Vec<Cell<usize>>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:80:5
|
||||
--> $DIR/mut_key.rs:81:5
|
||||
|
|
||||
LL | let _map = HashMap::<Result<&mut usize, ()>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:82:5
|
||||
--> $DIR/mut_key.rs:83:5
|
||||
|
|
||||
LL | let _map = HashMap::<Box<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:83:5
|
||||
--> $DIR/mut_key.rs:84:5
|
||||
|
|
||||
LL | let _map = HashMap::<Rc<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: mutable key type
|
||||
--> $DIR/mut_key.rs:84:5
|
||||
--> $DIR/mut_key.rs:85:5
|
||||
|
|
||||
LL | let _map = HashMap::<Arc<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
#![warn(clippy::needless_if)]
|
||||
|
||||
extern crate proc_macros;
|
||||
use proc_macros::external;
|
||||
use proc_macros::with_span;
|
||||
use proc_macros::{external, with_span};
|
||||
|
||||
fn maybe_side_effect() -> bool {
|
||||
true
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
#![warn(clippy::needless_if)]
|
||||
|
||||
extern crate proc_macros;
|
||||
use proc_macros::external;
|
||||
use proc_macros::with_span;
|
||||
use proc_macros::{external, with_span};
|
||||
|
||||
fn maybe_side_effect() -> bool {
|
||||
true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:28:5
|
||||
--> $DIR/needless_if.rs:27:5
|
||||
|
|
||||
LL | if (true) {}
|
||||
| ^^^^^^^^^^^^ help: you can remove it
|
||||
|
|
@ -7,13 +7,13 @@ LL | if (true) {}
|
|||
= note: `-D clippy::needless-if` implied by `-D warnings`
|
||||
|
||||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:30:5
|
||||
--> $DIR/needless_if.rs:29:5
|
||||
|
|
||||
LL | if maybe_side_effect() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `maybe_side_effect();`
|
||||
|
||||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:35:5
|
||||
--> $DIR/needless_if.rs:34:5
|
||||
|
|
||||
LL | / if {
|
||||
LL | | return;
|
||||
|
|
@ -28,7 +28,7 @@ LL + });
|
|||
|
|
||||
|
||||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:47:5
|
||||
--> $DIR/needless_if.rs:46:5
|
||||
|
|
||||
LL | / if {
|
||||
LL | | if let true = true && true { true } else { false }
|
||||
|
|
@ -44,19 +44,19 @@ LL + } && true);
|
|||
|
|
||||
|
||||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:85:5
|
||||
--> $DIR/needless_if.rs:84:5
|
||||
|
|
||||
LL | if { maybe_side_effect() } {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() });`
|
||||
|
||||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:87:5
|
||||
--> $DIR/needless_if.rs:86:5
|
||||
|
|
||||
LL | if { maybe_side_effect() } && true {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() } && true);`
|
||||
|
||||
error: this `if` branch is empty
|
||||
--> $DIR/needless_if.rs:91:5
|
||||
--> $DIR/needless_if.rs:90:5
|
||||
|
|
||||
LL | if true {}
|
||||
| ^^^^^^^^^^ help: you can remove it: `true;`
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@
|
|||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::time::Duration;
|
||||
|
||||
/// Checks implementation of the `OR_FUN_CALL` lint.
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@
|
|||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::time::Duration;
|
||||
|
||||
/// Checks implementation of the `OR_FUN_CALL` lint.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:54:22
|
||||
--> $DIR/or_fun_call.rs:53:22
|
||||
|
|
||||
LL | with_constructor.unwrap_or(make());
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(make)`
|
||||
|
|
@ -7,163 +7,163 @@ LL | with_constructor.unwrap_or(make());
|
|||
= note: `-D clippy::or-fun-call` implied by `-D warnings`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:57:14
|
||||
--> $DIR/or_fun_call.rs:56:14
|
||||
|
|
||||
LL | with_new.unwrap_or(Vec::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:60:21
|
||||
--> $DIR/or_fun_call.rs:59:21
|
||||
|
|
||||
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Vec::with_capacity(12))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:63:14
|
||||
--> $DIR/or_fun_call.rs:62:14
|
||||
|
|
||||
LL | with_err.unwrap_or(make());
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:66:19
|
||||
--> $DIR/or_fun_call.rs:65:19
|
||||
|
|
||||
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `default`
|
||||
--> $DIR/or_fun_call.rs:69:24
|
||||
--> $DIR/or_fun_call.rs:68:24
|
||||
|
|
||||
LL | with_default_trait.unwrap_or(Default::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `default`
|
||||
--> $DIR/or_fun_call.rs:72:23
|
||||
--> $DIR/or_fun_call.rs:71:23
|
||||
|
|
||||
LL | with_default_type.unwrap_or(u64::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:75:18
|
||||
--> $DIR/or_fun_call.rs:74:18
|
||||
|
|
||||
LL | self_default.unwrap_or(<FakeDefault>::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(<FakeDefault>::default)`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `default`
|
||||
--> $DIR/or_fun_call.rs:78:18
|
||||
--> $DIR/or_fun_call.rs:77:18
|
||||
|
|
||||
LL | real_default.unwrap_or(<FakeDefault as Default>::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:81:14
|
||||
--> $DIR/or_fun_call.rs:80:14
|
||||
|
|
||||
LL | with_vec.unwrap_or(vec![]);
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:84:21
|
||||
--> $DIR/or_fun_call.rs:83:21
|
||||
|
|
||||
LL | without_default.unwrap_or(Foo::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:87:19
|
||||
--> $DIR/or_fun_call.rs:86:19
|
||||
|
|
||||
LL | map.entry(42).or_insert(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:90:23
|
||||
--> $DIR/or_fun_call.rs:89:23
|
||||
|
|
||||
LL | map_vec.entry(42).or_insert(vec![]);
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:93:21
|
||||
--> $DIR/or_fun_call.rs:92:21
|
||||
|
|
||||
LL | btree.entry(42).or_insert(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:96:25
|
||||
--> $DIR/or_fun_call.rs:95:25
|
||||
|
|
||||
LL | btree_vec.entry(42).or_insert(vec![]);
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:99:21
|
||||
--> $DIR/or_fun_call.rs:98:21
|
||||
|
|
||||
LL | let _ = stringy.unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:107:21
|
||||
--> $DIR/or_fun_call.rs:106:21
|
||||
|
|
||||
LL | let _ = Some(1).unwrap_or(map[&1]);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:109:21
|
||||
--> $DIR/or_fun_call.rs:108:21
|
||||
|
|
||||
LL | let _ = Some(1).unwrap_or(map[&1]);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`
|
||||
|
||||
error: use of `or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:133:35
|
||||
--> $DIR/or_fun_call.rs:132:35
|
||||
|
|
||||
LL | let _ = Some("a".to_string()).or(Some("b".to_string()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:172:14
|
||||
--> $DIR/or_fun_call.rs:171:14
|
||||
|
|
||||
LL | None.unwrap_or(ptr_to_ref(s));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:178:14
|
||||
--> $DIR/or_fun_call.rs:177:14
|
||||
|
|
||||
LL | None.unwrap_or(unsafe { ptr_to_ref(s) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:180:14
|
||||
--> $DIR/or_fun_call.rs:179:14
|
||||
|
|
||||
LL | None.unwrap_or( unsafe { ptr_to_ref(s) } );
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:194:14
|
||||
--> $DIR/or_fun_call.rs:193:14
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:207:14
|
||||
--> $DIR/or_fun_call.rs:206:14
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:219:14
|
||||
--> $DIR/or_fun_call.rs:218:14
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:230:10
|
||||
--> $DIR/or_fun_call.rs:229:10
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `map_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:255:25
|
||||
--> $DIR/or_fun_call.rs:254:25
|
||||
|
|
||||
LL | let _ = Some(4).map_or(g(), |v| v);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)`
|
||||
|
||||
error: use of `map_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:256:25
|
||||
--> $DIR/or_fun_call.rs:255:25
|
||||
|
|
||||
LL | let _ = Some(4).map_or(g(), f);
|
||||
| ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)`
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ pub struct SubT<T> {
|
|||
}
|
||||
|
||||
mod outer_box {
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -28,8 +27,7 @@ mod outer_box {
|
|||
}
|
||||
|
||||
mod outer_rc {
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -48,8 +46,7 @@ mod outer_rc {
|
|||
}
|
||||
|
||||
mod outer_arc {
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: usage of `Box<Rc<T>>`
|
||||
--> $DIR/redundant_allocation.rs:17:30
|
||||
--> $DIR/redundant_allocation.rs:16:30
|
||||
|
|
||||
LL | pub fn box_test6<T>(foo: Box<Rc<T>>) {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -9,7 +9,7 @@ LL | pub fn box_test6<T>(foo: Box<Rc<T>>) {}
|
|||
= note: `-D clippy::redundant-allocation` implied by `-D warnings`
|
||||
|
||||
error: usage of `Box<Arc<T>>`
|
||||
--> $DIR/redundant_allocation.rs:19:30
|
||||
--> $DIR/redundant_allocation.rs:18:30
|
||||
|
|
||||
LL | pub fn box_test7<T>(foo: Box<Arc<T>>) {}
|
||||
| ^^^^^^^^^^^
|
||||
|
|
@ -18,7 +18,7 @@ LL | pub fn box_test7<T>(foo: Box<Arc<T>>) {}
|
|||
= help: consider using just `Box<T>` or `Arc<T>`
|
||||
|
||||
error: usage of `Box<Rc<SubT<usize>>>`
|
||||
--> $DIR/redundant_allocation.rs:21:27
|
||||
--> $DIR/redundant_allocation.rs:20:27
|
||||
|
|
||||
LL | pub fn box_test8() -> Box<Rc<SubT<usize>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -27,7 +27,7 @@ LL | pub fn box_test8() -> Box<Rc<SubT<usize>>> {
|
|||
= help: consider using just `Box<SubT<usize>>` or `Rc<SubT<usize>>`
|
||||
|
||||
error: usage of `Box<Arc<T>>`
|
||||
--> $DIR/redundant_allocation.rs:25:30
|
||||
--> $DIR/redundant_allocation.rs:24:30
|
||||
|
|
||||
LL | pub fn box_test9<T>(foo: Box<Arc<T>>) -> Box<Arc<SubT<T>>> {
|
||||
| ^^^^^^^^^^^
|
||||
|
|
@ -36,7 +36,7 @@ LL | pub fn box_test9<T>(foo: Box<Arc<T>>) -> Box<Arc<SubT<T>>> {
|
|||
= help: consider using just `Box<T>` or `Arc<T>`
|
||||
|
||||
error: usage of `Box<Arc<SubT<T>>>`
|
||||
--> $DIR/redundant_allocation.rs:25:46
|
||||
--> $DIR/redundant_allocation.rs:24:46
|
||||
|
|
||||
LL | pub fn box_test9<T>(foo: Box<Arc<T>>) -> Box<Arc<SubT<T>>> {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -45,7 +45,7 @@ LL | pub fn box_test9<T>(foo: Box<Arc<T>>) -> Box<Arc<SubT<T>>> {
|
|||
= help: consider using just `Box<SubT<T>>` or `Arc<SubT<T>>`
|
||||
|
||||
error: usage of `Rc<Box<bool>>`
|
||||
--> $DIR/redundant_allocation.rs:37:24
|
||||
--> $DIR/redundant_allocation.rs:35:24
|
||||
|
|
||||
LL | pub fn rc_test5(a: Rc<Box<bool>>) {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
@ -54,7 +54,7 @@ LL | pub fn rc_test5(a: Rc<Box<bool>>) {}
|
|||
= help: consider using just `Rc<bool>` or `Box<bool>`
|
||||
|
||||
error: usage of `Rc<Arc<bool>>`
|
||||
--> $DIR/redundant_allocation.rs:39:24
|
||||
--> $DIR/redundant_allocation.rs:37:24
|
||||
|
|
||||
LL | pub fn rc_test7(a: Rc<Arc<bool>>) {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
@ -63,7 +63,7 @@ LL | pub fn rc_test7(a: Rc<Arc<bool>>) {}
|
|||
= help: consider using just `Rc<bool>` or `Arc<bool>`
|
||||
|
||||
error: usage of `Rc<Box<SubT<usize>>>`
|
||||
--> $DIR/redundant_allocation.rs:41:26
|
||||
--> $DIR/redundant_allocation.rs:39:26
|
||||
|
|
||||
LL | pub fn rc_test8() -> Rc<Box<SubT<usize>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -72,7 +72,7 @@ LL | pub fn rc_test8() -> Rc<Box<SubT<usize>>> {
|
|||
= help: consider using just `Rc<SubT<usize>>` or `Box<SubT<usize>>`
|
||||
|
||||
error: usage of `Rc<Arc<T>>`
|
||||
--> $DIR/redundant_allocation.rs:45:29
|
||||
--> $DIR/redundant_allocation.rs:43:29
|
||||
|
|
||||
LL | pub fn rc_test9<T>(foo: Rc<Arc<T>>) -> Rc<Arc<SubT<T>>> {
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -81,7 +81,7 @@ LL | pub fn rc_test9<T>(foo: Rc<Arc<T>>) -> Rc<Arc<SubT<T>>> {
|
|||
= help: consider using just `Rc<T>` or `Arc<T>`
|
||||
|
||||
error: usage of `Rc<Arc<SubT<T>>>`
|
||||
--> $DIR/redundant_allocation.rs:45:44
|
||||
--> $DIR/redundant_allocation.rs:43:44
|
||||
|
|
||||
LL | pub fn rc_test9<T>(foo: Rc<Arc<T>>) -> Rc<Arc<SubT<T>>> {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
@ -90,7 +90,7 @@ LL | pub fn rc_test9<T>(foo: Rc<Arc<T>>) -> Rc<Arc<SubT<T>>> {
|
|||
= help: consider using just `Rc<SubT<T>>` or `Arc<SubT<T>>`
|
||||
|
||||
error: usage of `Arc<Box<bool>>`
|
||||
--> $DIR/redundant_allocation.rs:57:25
|
||||
--> $DIR/redundant_allocation.rs:54:25
|
||||
|
|
||||
LL | pub fn arc_test5(a: Arc<Box<bool>>) {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
@ -99,7 +99,7 @@ LL | pub fn arc_test5(a: Arc<Box<bool>>) {}
|
|||
= help: consider using just `Arc<bool>` or `Box<bool>`
|
||||
|
||||
error: usage of `Arc<Rc<bool>>`
|
||||
--> $DIR/redundant_allocation.rs:59:25
|
||||
--> $DIR/redundant_allocation.rs:56:25
|
||||
|
|
||||
LL | pub fn arc_test6(a: Arc<Rc<bool>>) {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
@ -108,7 +108,7 @@ LL | pub fn arc_test6(a: Arc<Rc<bool>>) {}
|
|||
= help: consider using just `Arc<bool>` or `Rc<bool>`
|
||||
|
||||
error: usage of `Arc<Box<SubT<usize>>>`
|
||||
--> $DIR/redundant_allocation.rs:61:27
|
||||
--> $DIR/redundant_allocation.rs:58:27
|
||||
|
|
||||
LL | pub fn arc_test8() -> Arc<Box<SubT<usize>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -117,7 +117,7 @@ LL | pub fn arc_test8() -> Arc<Box<SubT<usize>>> {
|
|||
= help: consider using just `Arc<SubT<usize>>` or `Box<SubT<usize>>`
|
||||
|
||||
error: usage of `Arc<Rc<T>>`
|
||||
--> $DIR/redundant_allocation.rs:65:30
|
||||
--> $DIR/redundant_allocation.rs:62:30
|
||||
|
|
||||
LL | pub fn arc_test9<T>(foo: Arc<Rc<T>>) -> Arc<Rc<SubT<T>>> {
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -126,7 +126,7 @@ LL | pub fn arc_test9<T>(foo: Arc<Rc<T>>) -> Arc<Rc<SubT<T>>> {
|
|||
= help: consider using just `Arc<T>` or `Rc<T>`
|
||||
|
||||
error: usage of `Arc<Rc<SubT<T>>>`
|
||||
--> $DIR/redundant_allocation.rs:65:45
|
||||
--> $DIR/redundant_allocation.rs:62:45
|
||||
|
|
||||
LL | pub fn arc_test9<T>(foo: Arc<Rc<T>>) -> Arc<Rc<SubT<T>>> {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
@ -135,7 +135,7 @@ LL | pub fn arc_test9<T>(foo: Arc<Rc<T>>) -> Arc<Rc<SubT<T>>> {
|
|||
= help: consider using just `Arc<SubT<T>>` or `Rc<SubT<T>>`
|
||||
|
||||
error: usage of `Rc<Box<Box<dyn T>>>`
|
||||
--> $DIR/redundant_allocation.rs:87:27
|
||||
--> $DIR/redundant_allocation.rs:84:27
|
||||
|
|
||||
LL | pub fn test_rc_box(_: Rc<Box<Box<dyn T>>>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -144,7 +144,7 @@ LL | pub fn test_rc_box(_: Rc<Box<Box<dyn T>>>) {}
|
|||
= help: consider using just `Rc<Box<dyn T>>` or `Box<Box<dyn T>>`
|
||||
|
||||
error: usage of `Rc<Box<Box<str>>>`
|
||||
--> $DIR/redundant_allocation.rs:119:31
|
||||
--> $DIR/redundant_allocation.rs:116:31
|
||||
|
|
||||
LL | pub fn test_rc_box_str(_: Rc<Box<Box<str>>>) {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -153,7 +153,7 @@ LL | pub fn test_rc_box_str(_: Rc<Box<Box<str>>>) {}
|
|||
= help: consider using just `Rc<Box<str>>` or `Box<Box<str>>`
|
||||
|
||||
error: usage of `Rc<Box<Box<[usize]>>>`
|
||||
--> $DIR/redundant_allocation.rs:120:33
|
||||
--> $DIR/redundant_allocation.rs:117:33
|
||||
|
|
||||
LL | pub fn test_rc_box_slice(_: Rc<Box<Box<[usize]>>>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -162,7 +162,7 @@ LL | pub fn test_rc_box_slice(_: Rc<Box<Box<[usize]>>>) {}
|
|||
= help: consider using just `Rc<Box<[usize]>>` or `Box<Box<[usize]>>`
|
||||
|
||||
error: usage of `Rc<Box<Box<Path>>>`
|
||||
--> $DIR/redundant_allocation.rs:121:32
|
||||
--> $DIR/redundant_allocation.rs:118:32
|
||||
|
|
||||
LL | pub fn test_rc_box_path(_: Rc<Box<Box<Path>>>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -171,7 +171,7 @@ LL | pub fn test_rc_box_path(_: Rc<Box<Box<Path>>>) {}
|
|||
= help: consider using just `Rc<Box<Path>>` or `Box<Box<Path>>`
|
||||
|
||||
error: usage of `Rc<Box<Box<DynSized>>>`
|
||||
--> $DIR/redundant_allocation.rs:122:34
|
||||
--> $DIR/redundant_allocation.rs:119:34
|
||||
|
|
||||
LL | pub fn test_rc_box_custom(_: Rc<Box<Box<DynSized>>>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ pub enum MyEnum {
|
|||
}
|
||||
|
||||
mod outer_box {
|
||||
use crate::MyEnum;
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyEnum, MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -35,9 +33,7 @@ mod outer_box {
|
|||
}
|
||||
|
||||
mod outer_rc {
|
||||
use crate::MyEnum;
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyEnum, MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -54,9 +50,7 @@ mod outer_rc {
|
|||
}
|
||||
|
||||
mod outer_arc {
|
||||
use crate::MyEnum;
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyEnum, MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ pub enum MyEnum {
|
|||
}
|
||||
|
||||
mod outer_box {
|
||||
use crate::MyEnum;
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyEnum, MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -35,9 +33,7 @@ mod outer_box {
|
|||
}
|
||||
|
||||
mod outer_rc {
|
||||
use crate::MyEnum;
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyEnum, MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -54,9 +50,7 @@ mod outer_rc {
|
|||
}
|
||||
|
||||
mod outer_arc {
|
||||
use crate::MyEnum;
|
||||
use crate::MyStruct;
|
||||
use crate::SubT;
|
||||
use crate::{MyEnum, MyStruct, SubT};
|
||||
use std::boxed::Box;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: usage of `Box<&T>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:26:30
|
||||
--> $DIR/redundant_allocation_fixable.rs:24:30
|
||||
|
|
||||
LL | pub fn box_test1<T>(foo: Box<&T>) {}
|
||||
| ^^^^^^^ help: try: `&T`
|
||||
|
|
@ -8,7 +8,7 @@ LL | pub fn box_test1<T>(foo: Box<&T>) {}
|
|||
= note: `-D clippy::redundant-allocation` implied by `-D warnings`
|
||||
|
||||
error: usage of `Box<&MyStruct>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:28:27
|
||||
--> $DIR/redundant_allocation_fixable.rs:26:27
|
||||
|
|
||||
LL | pub fn box_test2(foo: Box<&MyStruct>) {}
|
||||
| ^^^^^^^^^^^^^^ help: try: `&MyStruct`
|
||||
|
|
@ -16,7 +16,7 @@ LL | pub fn box_test2(foo: Box<&MyStruct>) {}
|
|||
= note: `&MyStruct` is already a pointer, `Box<&MyStruct>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Box<&MyEnum>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:30:27
|
||||
--> $DIR/redundant_allocation_fixable.rs:28:27
|
||||
|
|
||||
LL | pub fn box_test3(foo: Box<&MyEnum>) {}
|
||||
| ^^^^^^^^^^^^ help: try: `&MyEnum`
|
||||
|
|
@ -24,7 +24,7 @@ LL | pub fn box_test3(foo: Box<&MyEnum>) {}
|
|||
= note: `&MyEnum` is already a pointer, `Box<&MyEnum>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Box<Box<T>>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:34:30
|
||||
--> $DIR/redundant_allocation_fixable.rs:32:30
|
||||
|
|
||||
LL | pub fn box_test5<T>(foo: Box<Box<T>>) {}
|
||||
| ^^^^^^^^^^^ help: try: `Box<T>`
|
||||
|
|
@ -32,7 +32,7 @@ LL | pub fn box_test5<T>(foo: Box<Box<T>>) {}
|
|||
= note: `Box<T>` is already on the heap, `Box<Box<T>>` makes an extra allocation
|
||||
|
||||
error: usage of `Rc<&T>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:45:29
|
||||
--> $DIR/redundant_allocation_fixable.rs:41:29
|
||||
|
|
||||
LL | pub fn rc_test1<T>(foo: Rc<&T>) {}
|
||||
| ^^^^^^ help: try: `&T`
|
||||
|
|
@ -40,7 +40,7 @@ LL | pub fn rc_test1<T>(foo: Rc<&T>) {}
|
|||
= note: `&T` is already a pointer, `Rc<&T>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Rc<&MyStruct>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:47:26
|
||||
--> $DIR/redundant_allocation_fixable.rs:43:26
|
||||
|
|
||||
LL | pub fn rc_test2(foo: Rc<&MyStruct>) {}
|
||||
| ^^^^^^^^^^^^^ help: try: `&MyStruct`
|
||||
|
|
@ -48,7 +48,7 @@ LL | pub fn rc_test2(foo: Rc<&MyStruct>) {}
|
|||
= note: `&MyStruct` is already a pointer, `Rc<&MyStruct>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Rc<&MyEnum>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:49:26
|
||||
--> $DIR/redundant_allocation_fixable.rs:45:26
|
||||
|
|
||||
LL | pub fn rc_test3(foo: Rc<&MyEnum>) {}
|
||||
| ^^^^^^^^^^^ help: try: `&MyEnum`
|
||||
|
|
@ -56,7 +56,7 @@ LL | pub fn rc_test3(foo: Rc<&MyEnum>) {}
|
|||
= note: `&MyEnum` is already a pointer, `Rc<&MyEnum>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Rc<Rc<bool>>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:53:24
|
||||
--> $DIR/redundant_allocation_fixable.rs:49:24
|
||||
|
|
||||
LL | pub fn rc_test6(a: Rc<Rc<bool>>) {}
|
||||
| ^^^^^^^^^^^^ help: try: `Rc<bool>`
|
||||
|
|
@ -64,7 +64,7 @@ LL | pub fn rc_test6(a: Rc<Rc<bool>>) {}
|
|||
= note: `Rc<bool>` is already on the heap, `Rc<Rc<bool>>` makes an extra allocation
|
||||
|
||||
error: usage of `Arc<&T>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:64:30
|
||||
--> $DIR/redundant_allocation_fixable.rs:58:30
|
||||
|
|
||||
LL | pub fn arc_test1<T>(foo: Arc<&T>) {}
|
||||
| ^^^^^^^ help: try: `&T`
|
||||
|
|
@ -72,7 +72,7 @@ LL | pub fn arc_test1<T>(foo: Arc<&T>) {}
|
|||
= note: `&T` is already a pointer, `Arc<&T>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Arc<&MyStruct>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:66:27
|
||||
--> $DIR/redundant_allocation_fixable.rs:60:27
|
||||
|
|
||||
LL | pub fn arc_test2(foo: Arc<&MyStruct>) {}
|
||||
| ^^^^^^^^^^^^^^ help: try: `&MyStruct`
|
||||
|
|
@ -80,7 +80,7 @@ LL | pub fn arc_test2(foo: Arc<&MyStruct>) {}
|
|||
= note: `&MyStruct` is already a pointer, `Arc<&MyStruct>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Arc<&MyEnum>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:68:27
|
||||
--> $DIR/redundant_allocation_fixable.rs:62:27
|
||||
|
|
||||
LL | pub fn arc_test3(foo: Arc<&MyEnum>) {}
|
||||
| ^^^^^^^^^^^^ help: try: `&MyEnum`
|
||||
|
|
@ -88,7 +88,7 @@ LL | pub fn arc_test3(foo: Arc<&MyEnum>) {}
|
|||
= note: `&MyEnum` is already a pointer, `Arc<&MyEnum>` allocates a pointer on the heap
|
||||
|
||||
error: usage of `Arc<Arc<bool>>`
|
||||
--> $DIR/redundant_allocation_fixable.rs:72:25
|
||||
--> $DIR/redundant_allocation_fixable.rs:66:25
|
||||
|
|
||||
LL | pub fn arc_test7(a: Arc<Arc<bool>>) {}
|
||||
| ^^^^^^^^^^^^^^ help: try: `Arc<bool>`
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@
|
|||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::net::{
|
||||
IpAddr::{self, V4, V6},
|
||||
Ipv4Addr, Ipv6Addr,
|
||||
};
|
||||
use std::net::IpAddr::{self, V4, V6};
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
|
||||
fn main() {
|
||||
let ipaddr: IpAddr = V4(Ipv4Addr::LOCALHOST);
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@
|
|||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::net::{
|
||||
IpAddr::{self, V4, V6},
|
||||
Ipv4Addr, Ipv6Addr,
|
||||
};
|
||||
use std::net::IpAddr::{self, V4, V6};
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
|
||||
fn main() {
|
||||
let ipaddr: IpAddr = V4(Ipv4Addr::LOCALHOST);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:18:12
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:16:12
|
||||
|
|
||||
LL | if let V4(_) = &ipaddr {}
|
||||
| -------^^^^^---------- help: try: `if ipaddr.is_ipv4()`
|
||||
|
|
@ -7,31 +7,31 @@ LL | if let V4(_) = &ipaddr {}
|
|||
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:20:12
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:18:12
|
||||
|
|
||||
LL | if let V4(_) = V4(Ipv4Addr::LOCALHOST) {}
|
||||
| -------^^^^^-------------------------- help: try: `if V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:22:12
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:20:12
|
||||
|
|
||||
LL | if let V6(_) = V6(Ipv6Addr::LOCALHOST) {}
|
||||
| -------^^^^^-------------------------- help: try: `if V6(Ipv6Addr::LOCALHOST).is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:24:15
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:22:15
|
||||
|
|
||||
LL | while let V4(_) = V4(Ipv4Addr::LOCALHOST) {}
|
||||
| ----------^^^^^-------------------------- help: try: `while V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:26:15
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:24:15
|
||||
|
|
||||
LL | while let V6(_) = V6(Ipv6Addr::LOCALHOST) {}
|
||||
| ----------^^^^^-------------------------- help: try: `while V6(Ipv6Addr::LOCALHOST).is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:36:5
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:34:5
|
||||
|
|
||||
LL | / match V4(Ipv4Addr::LOCALHOST) {
|
||||
LL | | V4(_) => true,
|
||||
|
|
@ -40,7 +40,7 @@ LL | | };
|
|||
| |_____^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:41:5
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:39:5
|
||||
|
|
||||
LL | / match V4(Ipv4Addr::LOCALHOST) {
|
||||
LL | | V4(_) => false,
|
||||
|
|
@ -49,7 +49,7 @@ LL | | };
|
|||
| |_____^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:46:5
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:44:5
|
||||
|
|
||||
LL | / match V6(Ipv6Addr::LOCALHOST) {
|
||||
LL | | V4(_) => false,
|
||||
|
|
@ -58,7 +58,7 @@ LL | | };
|
|||
| |_____^ help: try: `V6(Ipv6Addr::LOCALHOST).is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:51:5
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:49:5
|
||||
|
|
||||
LL | / match V6(Ipv6Addr::LOCALHOST) {
|
||||
LL | | V4(_) => true,
|
||||
|
|
@ -67,49 +67,49 @@ LL | | };
|
|||
| |_____^ help: try: `V6(Ipv6Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:56:20
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:54:20
|
||||
|
|
||||
LL | let _ = if let V4(_) = V4(Ipv4Addr::LOCALHOST) {
|
||||
| -------^^^^^-------------------------- help: try: `if V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:64:20
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:62:20
|
||||
|
|
||||
LL | let _ = if let V4(_) = gen_ipaddr() {
|
||||
| -------^^^^^--------------- help: try: `if gen_ipaddr().is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:66:19
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:64:19
|
||||
|
|
||||
LL | } else if let V6(_) = gen_ipaddr() {
|
||||
| -------^^^^^--------------- help: try: `if gen_ipaddr().is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:78:12
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:76:12
|
||||
|
|
||||
LL | if let V4(_) = V4(Ipv4Addr::LOCALHOST) {}
|
||||
| -------^^^^^-------------------------- help: try: `if V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:80:12
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:78:12
|
||||
|
|
||||
LL | if let V6(_) = V6(Ipv6Addr::LOCALHOST) {}
|
||||
| -------^^^^^-------------------------- help: try: `if V6(Ipv6Addr::LOCALHOST).is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:82:15
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:80:15
|
||||
|
|
||||
LL | while let V4(_) = V4(Ipv4Addr::LOCALHOST) {}
|
||||
| ----------^^^^^-------------------------- help: try: `while V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:84:15
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:82:15
|
||||
|
|
||||
LL | while let V6(_) = V6(Ipv6Addr::LOCALHOST) {}
|
||||
| ----------^^^^^-------------------------- help: try: `while V6(Ipv6Addr::LOCALHOST).is_ipv6()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv4()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:86:5
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:84:5
|
||||
|
|
||||
LL | / match V4(Ipv4Addr::LOCALHOST) {
|
||||
LL | | V4(_) => true,
|
||||
|
|
@ -118,7 +118,7 @@ LL | | };
|
|||
| |_____^ help: try: `V4(Ipv4Addr::LOCALHOST).is_ipv4()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ipv6()`
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:91:5
|
||||
--> $DIR/redundant_pattern_matching_ipaddr.rs:89:5
|
||||
|
|
||||
LL | / match V6(Ipv6Addr::LOCALHOST) {
|
||||
LL | | V4(_) => false,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
use std::num::ParseIntError;
|
||||
use std::ops::Deref;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::RwLock;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
use std::sync::{Mutex, MutexGuard, RwLock};
|
||||
|
||||
struct State {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:56:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:55:11
|
||||
|
|
||||
LL | match mutex.lock().unwrap().foo() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -19,7 +19,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:142:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:141:11
|
||||
|
|
||||
LL | match s.lock_m().get_the_value() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -38,7 +38,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:163:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:162:11
|
||||
|
|
||||
LL | match s.lock_m_m().get_the_value() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -57,7 +57,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:211:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:210:11
|
||||
|
|
||||
LL | match counter.temp_increment().len() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -73,7 +73,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:234:16
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:233:16
|
||||
|
|
||||
LL | match (mutex1.lock().unwrap().s.len(), true) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -92,7 +92,7 @@ LL ~ match (value, true) {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:243:22
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:242:22
|
||||
|
|
||||
LL | match (true, mutex1.lock().unwrap().s.len(), true) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -111,7 +111,7 @@ LL ~ match (true, value, true) {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:253:16
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:252:16
|
||||
|
|
||||
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -132,7 +132,7 @@ LL ~ match (value, true, mutex2.lock().unwrap().s.len()) {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:253:54
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:252:54
|
||||
|
|
||||
LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -153,7 +153,7 @@ LL ~ match (mutex1.lock().unwrap().s.len(), true, value) {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:264:15
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:263:15
|
||||
|
|
||||
LL | match mutex3.lock().unwrap().s.as_str() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -169,7 +169,7 @@ LL | };
|
|||
= note: this might lead to deadlocks or other unexpected behavior
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:274:22
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:273:22
|
||||
|
|
||||
LL | match (true, mutex3.lock().unwrap().s.as_str()) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -185,7 +185,7 @@ LL | };
|
|||
= note: this might lead to deadlocks or other unexpected behavior
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:293:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:292:11
|
||||
|
|
||||
LL | match mutex.lock().unwrap().s.len() > 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -204,7 +204,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:300:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:299:11
|
||||
|
|
||||
LL | match 1 < mutex.lock().unwrap().s.len() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -223,7 +223,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:318:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:317:11
|
||||
|
|
||||
LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -244,7 +244,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:329:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:328:11
|
||||
|
|
||||
LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -265,7 +265,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:364:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:363:11
|
||||
|
|
||||
LL | match get_mutex_guard().s.len() > 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -284,7 +284,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:381:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:380:11
|
||||
|
|
||||
LL | match match i {
|
||||
| ___________^
|
||||
|
|
@ -316,7 +316,7 @@ LL ~ match value
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:407:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:406:11
|
||||
|
|
||||
LL | match if i > 1 {
|
||||
| ___________^
|
||||
|
|
@ -349,7 +349,7 @@ LL ~ match value
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:461:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:460:11
|
||||
|
|
||||
LL | match s.lock().deref().deref() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -367,7 +367,7 @@ LL ~ match value {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:489:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:488:11
|
||||
|
|
||||
LL | match s.lock().deref().deref() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -380,7 +380,7 @@ LL | };
|
|||
= note: this might lead to deadlocks or other unexpected behavior
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:508:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:507:11
|
||||
|
|
||||
LL | match mutex.lock().unwrap().i = i {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -399,7 +399,7 @@ LL ~ match () {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:514:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:513:11
|
||||
|
|
||||
LL | match i = mutex.lock().unwrap().i {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -418,7 +418,7 @@ LL ~ match () {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:520:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:519:11
|
||||
|
|
||||
LL | match mutex.lock().unwrap().i += 1 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -437,7 +437,7 @@ LL ~ match () {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:526:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:525:11
|
||||
|
|
||||
LL | match i += mutex.lock().unwrap().i {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -456,7 +456,7 @@ LL ~ match () {
|
|||
|
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:589:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:588:11
|
||||
|
|
||||
LL | match rwlock.read().unwrap().to_number() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -467,7 +467,7 @@ LL | };
|
|||
= note: this might lead to deadlocks or other unexpected behavior
|
||||
|
||||
error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:599:14
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:598:14
|
||||
|
|
||||
LL | for s in rwlock.read().unwrap().iter() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -478,7 +478,7 @@ LL | }
|
|||
= note: this might lead to deadlocks or other unexpected behavior
|
||||
|
||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:614:11
|
||||
--> $DIR/significant_drop_in_scrutinee.rs:613:11
|
||||
|
|
||||
LL | match mutex.lock().unwrap().foo() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@
|
|||
|
||||
use core;
|
||||
|
||||
|
||||
|
||||
use serde as edres;
|
||||
|
||||
pub use serde;
|
||||
|
||||
use std;
|
||||
|
||||
macro_rules! m {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,13 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
use core;
|
||||
|
||||
use regex;
|
||||
|
||||
use serde as edres;
|
||||
|
||||
pub use serde;
|
||||
|
||||
use std;
|
||||
|
||||
macro_rules! m {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: this import is redundant
|
||||
--> $DIR/single_component_path_imports.rs:6:1
|
||||
--> $DIR/single_component_path_imports.rs:7:1
|
||||
|
|
||||
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:29:5
|
||||
--> $DIR/single_component_path_imports.rs:33:5
|
||||
|
|
||||
LL | use regex;
|
||||
| ^^^^^^^^^^ help: remove it entirely
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
use regex;
|
||||
|
||||
use serde as edres;
|
||||
|
||||
pub use serde;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -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_nested_first.rs:13:10
|
||||
--> $DIR/single_component_path_imports_nested_first.rs:15:10
|
||||
|
|
||||
LL | use {regex, serde};
|
||||
| ^^^^^
|
||||
|
|
@ -15,7 +15,7 @@ LL | use {regex, serde};
|
|||
= help: remove this import
|
||||
|
||||
error: this import is redundant
|
||||
--> $DIR/single_component_path_imports_nested_first.rs:13:17
|
||||
--> $DIR/single_component_path_imports_nested_first.rs:15:17
|
||||
|
|
||||
LL | use {regex, serde};
|
||||
| ^^^^^
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
use self::regex::{Regex as xeger, RegexSet as tesxeger};
|
||||
#[rustfmt::skip]
|
||||
pub use self::{
|
||||
regex::{Regex, RegexSet},
|
||||
some_mod::SomeType,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
use regex;
|
||||
|
||||
use self::regex::{Regex as xeger, RegexSet as tesxeger};
|
||||
#[rustfmt::skip]
|
||||
pub use self::{
|
||||
regex::{Regex, RegexSet},
|
||||
some_mod::SomeType,
|
||||
|
|
|
|||
|
|
@ -477,7 +477,8 @@ mod issue_10021 {
|
|||
|
||||
mod issue_10033 {
|
||||
#![allow(dead_code)]
|
||||
use std::{fmt::Display, ops::Deref};
|
||||
use std::fmt::Display;
|
||||
use std::ops::Deref;
|
||||
|
||||
fn _main() {
|
||||
let f = Foo;
|
||||
|
|
|
|||
|
|
@ -477,7 +477,8 @@ mod issue_10021 {
|
|||
|
||||
mod issue_10033 {
|
||||
#![allow(dead_code)]
|
||||
use std::{fmt::Display, ops::Deref};
|
||||
use std::fmt::Display;
|
||||
use std::ops::Deref;
|
||||
|
||||
fn _main() {
|
||||
let f = Foo;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,13 @@ use std::cell::UnsafeCell as TotallySafeCellAgain;
|
|||
|
||||
// Shouldn't error
|
||||
use std::cell::RefCell as ProbablyNotUnsafe;
|
||||
|
||||
use std::cell::RefCell as RefCellThatCantBeUnsafe;
|
||||
|
||||
use std::cell::UnsafeCell as SuperDangerousUnsafeCell;
|
||||
|
||||
use std::cell::UnsafeCell as Dangerunsafe;
|
||||
|
||||
use std::cell::UnsafeCell as Bombsawayunsafe;
|
||||
|
||||
mod mod_with_some_unsafe_things {
|
||||
|
|
@ -20,8 +24,12 @@ mod mod_with_some_unsafe_things {
|
|||
|
||||
use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety;
|
||||
|
||||
// merged imports
|
||||
use mod_with_some_unsafe_things::{Unsafe as A, Unsafe as B};
|
||||
|
||||
// Shouldn't error
|
||||
use mod_with_some_unsafe_things::Safe as IPromiseItsSafeThisTime;
|
||||
|
||||
use mod_with_some_unsafe_things::Unsafe as SuperUnsafeModThing;
|
||||
|
||||
#[allow(clippy::unsafe_removed_from_name)]
|
||||
|
|
|
|||
|
|
@ -13,10 +13,22 @@ LL | use std::cell::UnsafeCell as TotallySafeCellAgain;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: removed `unsafe` from the name of `Unsafe` in use as `LieAboutModSafety`
|
||||
--> $DIR/unsafe_removed_from_name.rs:21:1
|
||||
--> $DIR/unsafe_removed_from_name.rs:25:1
|
||||
|
|
||||
LL | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: removed `unsafe` from the name of `Unsafe` in use as `A`
|
||||
--> $DIR/unsafe_removed_from_name.rs:28:1
|
||||
|
|
||||
LL | use mod_with_some_unsafe_things::{Unsafe as A, Unsafe as B};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: removed `unsafe` from the name of `Unsafe` in use as `B`
|
||||
--> $DIR/unsafe_removed_from_name.rs:28:1
|
||||
|
|
||||
LL | use mod_with_some_unsafe_things::{Unsafe as A, Unsafe as B};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#![warn(clippy::unused_peekable)]
|
||||
#![allow(clippy::no_effect)]
|
||||
|
||||
use std::iter::Empty;
|
||||
use std::iter::Peekable;
|
||||
use std::iter::{Empty, Peekable};
|
||||
|
||||
fn main() {
|
||||
invalid();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:14:9
|
||||
--> $DIR/unused_peekable.rs:13:9
|
||||
|
|
||||
LL | let peekable = std::iter::empty::<u32>().peekable();
|
||||
| ^^^^^^^^
|
||||
|
|
@ -8,7 +8,7 @@ LL | let peekable = std::iter::empty::<u32>().peekable();
|
|||
= note: `-D clippy::unused-peekable` implied by `-D warnings`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:18:9
|
||||
--> $DIR/unused_peekable.rs:17:9
|
||||
|
|
||||
LL | let new_local = old_local;
|
||||
| ^^^^^^^^^
|
||||
|
|
@ -16,7 +16,7 @@ LL | let new_local = old_local;
|
|||
= help: consider removing the call to `peekable`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:22:9
|
||||
--> $DIR/unused_peekable.rs:21:9
|
||||
|
|
||||
LL | let by_mut_ref = &mut by_mut_ref_test;
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -24,7 +24,7 @@ LL | let by_mut_ref = &mut by_mut_ref_test;
|
|||
= help: consider removing the call to `peekable`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:29:9
|
||||
--> $DIR/unused_peekable.rs:28:9
|
||||
|
|
||||
LL | let peekable_from_fn = returns_peekable();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
@ -32,7 +32,7 @@ LL | let peekable_from_fn = returns_peekable();
|
|||
= help: consider removing the call to `peekable`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:32:13
|
||||
--> $DIR/unused_peekable.rs:31:13
|
||||
|
|
||||
LL | let mut peekable_using_iterator_method = std::iter::empty::<u32>().peekable();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -40,7 +40,7 @@ LL | let mut peekable_using_iterator_method = std::iter::empty::<u32>().peek
|
|||
= help: consider removing the call to `peekable`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:37:9
|
||||
--> $DIR/unused_peekable.rs:36:9
|
||||
|
|
||||
LL | let passed_along_ref = std::iter::empty::<u32>().peekable();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
@ -48,7 +48,7 @@ LL | let passed_along_ref = std::iter::empty::<u32>().peekable();
|
|||
= help: consider removing the call to `peekable`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:42:9
|
||||
--> $DIR/unused_peekable.rs:41:9
|
||||
|
|
||||
LL | let _by_ref = by_ref_test.by_ref();
|
||||
| ^^^^^^^
|
||||
|
|
@ -56,7 +56,7 @@ LL | let _by_ref = by_ref_test.by_ref();
|
|||
= help: consider removing the call to `peekable`
|
||||
|
||||
error: `peek` never called on `Peekable` iterator
|
||||
--> $DIR/unused_peekable.rs:44:13
|
||||
--> $DIR/unused_peekable.rs:43:13
|
||||
|
|
||||
LL | let mut peekable_in_for_loop = std::iter::empty::<u32>().peekable();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ mod in_fn_test {
|
|||
}
|
||||
|
||||
fn test_inner_nested() {
|
||||
#[rustfmt::skip]
|
||||
use self::{inner::inner_foo, inner2::inner_bar};
|
||||
|
||||
inner_foo();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ mod in_fn_test {
|
|||
}
|
||||
|
||||
fn test_inner_nested() {
|
||||
#[rustfmt::skip]
|
||||
use self::{inner::*, inner2::*};
|
||||
|
||||
inner_foo();
|
||||
|
|
|
|||
|
|
@ -55,37 +55,37 @@ LL | use wildcard_imports_helper::*;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:115:20
|
||||
--> $DIR/wildcard_imports.rs:116:20
|
||||
|
|
||||
LL | use self::{inner::*, inner2::*};
|
||||
| ^^^^^^^^ help: try: `inner::inner_foo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:115:30
|
||||
--> $DIR/wildcard_imports.rs:116:30
|
||||
|
|
||||
LL | use self::{inner::*, inner2::*};
|
||||
| ^^^^^^^^^ help: try: `inner2::inner_bar`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:122:13
|
||||
--> $DIR/wildcard_imports.rs:123:13
|
||||
|
|
||||
LL | use wildcard_imports_helper::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:151:9
|
||||
--> $DIR/wildcard_imports.rs:152:9
|
||||
|
|
||||
LL | use crate::in_fn_test::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:160:9
|
||||
--> $DIR/wildcard_imports.rs:161:9
|
||||
|
|
||||
LL | use crate:: in_fn_test:: * ;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:161:9
|
||||
--> $DIR/wildcard_imports.rs:162:9
|
||||
|
|
||||
LL | use crate:: fn_mod::
|
||||
| _________^
|
||||
|
|
@ -93,37 +93,37 @@ LL | | *;
|
|||
| |_________^ help: try: `crate:: fn_mod::foo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:172:13
|
||||
--> $DIR/wildcard_imports.rs:173:13
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:207:17
|
||||
--> $DIR/wildcard_imports.rs:208:17
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::insidefoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:215:13
|
||||
--> $DIR/wildcard_imports.rs:216:13
|
||||
|
|
||||
LL | use crate::super_imports::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::super_imports::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:224:17
|
||||
--> $DIR/wildcard_imports.rs:225:17
|
||||
|
|
||||
LL | use super::super::*;
|
||||
| ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:233:13
|
||||
--> $DIR/wildcard_imports.rs:234:13
|
||||
|
|
||||
LL | use super::super::super_imports::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports.rs:241:13
|
||||
--> $DIR/wildcard_imports.rs:242:13
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::foofoo`
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ mod in_fn_test {
|
|||
}
|
||||
|
||||
fn test_inner_nested() {
|
||||
#[rustfmt::skip]
|
||||
use self::{inner::inner_foo, inner2::inner_bar};
|
||||
|
||||
inner_foo();
|
||||
|
|
|
|||
|
|
@ -55,37 +55,37 @@ LL | use wildcard_imports_helper::*;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:109:20
|
||||
--> $DIR/wildcard_imports_2021.rs:110:20
|
||||
|
|
||||
LL | use self::{inner::*, inner2::*};
|
||||
| ^^^^^^^^ help: try: `inner::inner_foo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:109:30
|
||||
--> $DIR/wildcard_imports_2021.rs:110:30
|
||||
|
|
||||
LL | use self::{inner::*, inner2::*};
|
||||
| ^^^^^^^^^ help: try: `inner2::inner_bar`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:116:13
|
||||
--> $DIR/wildcard_imports_2021.rs:117:13
|
||||
|
|
||||
LL | use wildcard_imports_helper::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:145:9
|
||||
--> $DIR/wildcard_imports_2021.rs:146:9
|
||||
|
|
||||
LL | use crate::in_fn_test::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:154:9
|
||||
--> $DIR/wildcard_imports_2021.rs:155:9
|
||||
|
|
||||
LL | use crate:: in_fn_test:: * ;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:155:9
|
||||
--> $DIR/wildcard_imports_2021.rs:156:9
|
||||
|
|
||||
LL | use crate:: fn_mod::
|
||||
| _________^
|
||||
|
|
@ -93,37 +93,37 @@ LL | | *;
|
|||
| |_________^ help: try: `crate:: fn_mod::foo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:166:13
|
||||
--> $DIR/wildcard_imports_2021.rs:167:13
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:201:17
|
||||
--> $DIR/wildcard_imports_2021.rs:202:17
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::insidefoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:209:13
|
||||
--> $DIR/wildcard_imports_2021.rs:210:13
|
||||
|
|
||||
LL | use crate::super_imports::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::super_imports::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:218:17
|
||||
--> $DIR/wildcard_imports_2021.rs:219:17
|
||||
|
|
||||
LL | use super::super::*;
|
||||
| ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:227:13
|
||||
--> $DIR/wildcard_imports_2021.rs:228:13
|
||||
|
|
||||
LL | use super::super::super_imports::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:235:13
|
||||
--> $DIR/wildcard_imports_2021.rs:236:13
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::foofoo`
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ mod in_fn_test {
|
|||
}
|
||||
|
||||
fn test_inner_nested() {
|
||||
#[rustfmt::skip]
|
||||
use self::{inner::inner_foo, inner2::inner_bar};
|
||||
|
||||
inner_foo();
|
||||
|
|
|
|||
|
|
@ -55,37 +55,37 @@ LL | use wildcard_imports_helper::*;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternA, extern_foo}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:109:20
|
||||
--> $DIR/wildcard_imports_2021.rs:110:20
|
||||
|
|
||||
LL | use self::{inner::*, inner2::*};
|
||||
| ^^^^^^^^ help: try: `inner::inner_foo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:109:30
|
||||
--> $DIR/wildcard_imports_2021.rs:110:30
|
||||
|
|
||||
LL | use self::{inner::*, inner2::*};
|
||||
| ^^^^^^^^^ help: try: `inner2::inner_bar`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:116:13
|
||||
--> $DIR/wildcard_imports_2021.rs:117:13
|
||||
|
|
||||
LL | use wildcard_imports_helper::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `wildcard_imports_helper::{ExternExportedEnum, ExternExportedStruct, extern_exported}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:145:9
|
||||
--> $DIR/wildcard_imports_2021.rs:146:9
|
||||
|
|
||||
LL | use crate::in_fn_test::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try: `crate::in_fn_test::{ExportedEnum, ExportedStruct, exported}`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:154:9
|
||||
--> $DIR/wildcard_imports_2021.rs:155:9
|
||||
|
|
||||
LL | use crate:: in_fn_test:: * ;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate:: in_fn_test::exported`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:155:9
|
||||
--> $DIR/wildcard_imports_2021.rs:156:9
|
||||
|
|
||||
LL | use crate:: fn_mod::
|
||||
| _________^
|
||||
|
|
@ -93,37 +93,37 @@ LL | | *;
|
|||
| |_________^ help: try: `crate:: fn_mod::foo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:166:13
|
||||
--> $DIR/wildcard_imports_2021.rs:167:13
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:201:17
|
||||
--> $DIR/wildcard_imports_2021.rs:202:17
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::insidefoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:209:13
|
||||
--> $DIR/wildcard_imports_2021.rs:210:13
|
||||
|
|
||||
LL | use crate::super_imports::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crate::super_imports::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:218:17
|
||||
--> $DIR/wildcard_imports_2021.rs:219:17
|
||||
|
|
||||
LL | use super::super::*;
|
||||
| ^^^^^^^^^^^^^^^ help: try: `super::super::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:227:13
|
||||
--> $DIR/wildcard_imports_2021.rs:228:13
|
||||
|
|
||||
LL | use super::super::super_imports::*;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `super::super::super_imports::foofoo`
|
||||
|
||||
error: usage of wildcard import
|
||||
--> $DIR/wildcard_imports_2021.rs:235:13
|
||||
--> $DIR/wildcard_imports_2021.rs:236:13
|
||||
|
|
||||
LL | use super::*;
|
||||
| ^^^^^^^^ help: try: `super::foofoo`
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ mod in_fn_test {
|
|||
}
|
||||
|
||||
fn test_inner_nested() {
|
||||
#[rustfmt::skip]
|
||||
use self::{inner::*, inner2::*};
|
||||
|
||||
inner_foo();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue