-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ui test for
incompatible_msrv
lint
- Loading branch information
1 parent
6b96de0
commit 2093bf1
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![warn(clippy::incompatible_msrv)] | ||
#![feature(custom_inner_attributes)] | ||
#![clippy::msrv = "1.3.0"] | ||
|
||
use std::collections::hash_map::Entry; | ||
use std::collections::HashMap; | ||
use std::thread::sleep; | ||
use std::time::Duration; | ||
|
||
fn foo() { | ||
let mut map: HashMap<&str, u32> = HashMap::new(); | ||
// Stable since 1.10, so should not warn. | ||
assert_eq!(map.entry("poneyland").key(), &"poneyland"); | ||
if let Entry::Vacant(v) = map.entry("poneyland") { | ||
v.into_key(); | ||
//~^ ERROR: MSRV is `1.3.0` but this item is stable since `1.12.0` | ||
} | ||
// Should warn for `sleep` but not for `Duration` (which was added in `1.3.0`). | ||
sleep(Duration::new(1, 0)); | ||
//~^ ERROR: MSRV is `1.3.0` but this item is stable since `1.4.0` | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: current MSRV is `1.3.0` but this item is stable since `1.10.0` | ||
--> $DIR/incompatible_msrv.rs:13:39 | ||
| | ||
LL | assert_eq!(map.entry("poneyland").key(), &"poneyland"); | ||
| ^^^^^ | ||
| | ||
= note: `-D clippy::incompatible-msrv` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]` | ||
|
||
error: current MSRV is `1.3.0` but this item is stable since `1.12.0` | ||
--> $DIR/incompatible_msrv.rs:15:11 | ||
| | ||
LL | v.into_key(); | ||
| ^^^^^^^^^^ | ||
|
||
error: current MSRV is `1.3.0` but this item is stable since `1.4.0` | ||
--> $DIR/incompatible_msrv.rs:19:5 | ||
| | ||
LL | sleep(Duration::new(1, 0)); | ||
| ^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|