mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
Auto merge of #6374 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: [`panic`],[`unimplemented`],[`unreachable`],[`todo`] now also handle the `core::` version of those macros correctly.
This commit is contained in:
commit
5b40ce3f2d
8 changed files with 20 additions and 10 deletions
|
@ -365,6 +365,9 @@ pub fn implements_trait<'tcx>(
|
|||
return false;
|
||||
}
|
||||
let ty = cx.tcx.erase_regions(ty);
|
||||
if ty.has_escaping_bound_vars() {
|
||||
return false;
|
||||
}
|
||||
let ty_params = cx.tcx.mk_substs(ty_params.iter());
|
||||
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
|
||||
}
|
||||
|
|
5
tests/ui/crashes/implements-trait.rs
Normal file
5
tests/ui/crashes/implements-trait.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#[allow(clippy::needless_borrowed_reference)]
|
||||
fn main() {
|
||||
let mut v = Vec::<String>::new();
|
||||
let _ = v.iter_mut().filter(|&ref a| a.is_empty());
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(unused, clippy::many_single_char_names)]
|
||||
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::logic_bug)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(unused, clippy::many_single_char_names)]
|
||||
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::nonminimal_bool)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(unused, clippy::many_single_char_names)]
|
||||
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::nonminimal_bool)]
|
||||
|
||||
fn methods_with_negation() {
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
dead_code,
|
||||
clippy::single_match,
|
||||
clippy::wildcard_in_or_patterns,
|
||||
clippy::unnested_or_patterns
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::diverging_sub_expression
|
||||
)]
|
||||
|
||||
use std::io::ErrorKind;
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
dead_code,
|
||||
clippy::single_match,
|
||||
clippy::wildcard_in_or_patterns,
|
||||
clippy::unnested_or_patterns
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::diverging_sub_expression
|
||||
)]
|
||||
|
||||
use std::io::ErrorKind;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:38:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:39:9
|
||||
|
|
||||
LL | _ => eprintln!("Not red"),
|
||||
| ^ help: try this: `Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan`
|
||||
|
@ -11,25 +11,25 @@ LL | #![deny(clippy::wildcard_enum_match_arm)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:42:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:43:9
|
||||
|
|
||||
LL | _not_red => eprintln!("Not red"),
|
||||
| ^^^^^^^^ help: try this: `_not_red @ Color::Green | _not_red @ Color::Blue | _not_red @ Color::Rgb(..) | _not_red @ Color::Cyan`
|
||||
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:46:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:47:9
|
||||
|
|
||||
LL | not_red => format!("{:?}", not_red),
|
||||
| ^^^^^^^ help: try this: `not_red @ Color::Green | not_red @ Color::Blue | not_red @ Color::Rgb(..) | not_red @ Color::Cyan`
|
||||
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:62:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:63:9
|
||||
|
|
||||
LL | _ => "No red",
|
||||
| ^ help: try this: `Color::Red | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan`
|
||||
|
||||
error: match on non-exhaustive enum doesn't explicitly match all known variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:79:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:80:9
|
||||
|
|
||||
LL | _ => {},
|
||||
| ^ help: try this: `std::io::ErrorKind::PermissionDenied | std::io::ErrorKind::ConnectionRefused | std::io::ErrorKind::ConnectionReset | std::io::ErrorKind::ConnectionAborted | std::io::ErrorKind::NotConnected | std::io::ErrorKind::AddrInUse | std::io::ErrorKind::AddrNotAvailable | std::io::ErrorKind::BrokenPipe | std::io::ErrorKind::AlreadyExists | std::io::ErrorKind::WouldBlock | std::io::ErrorKind::InvalidInput | std::io::ErrorKind::InvalidData | std::io::ErrorKind::TimedOut | std::io::ErrorKind::WriteZero | std::io::ErrorKind::Interrupted | std::io::ErrorKind::Other | std::io::ErrorKind::UnexpectedEof | _`
|
||||
|
|
Loading…
Reference in a new issue