File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ warn( clippy:: incompatible_msrv) ]
2
+ #![ feature( custom_inner_attributes) ]
3
+ #![ clippy:: msrv = "1.3.0" ]
4
+
5
+ use std:: collections:: hash_map:: Entry ;
6
+ use std:: collections:: HashMap ;
7
+ use std:: thread:: sleep;
8
+ use std:: time:: Duration ;
9
+
10
+ fn foo ( ) {
11
+ let mut map: HashMap < & str , u32 > = HashMap :: new ( ) ;
12
+ // Stable since 1.10, so should not warn.
13
+ assert_eq ! ( map. entry( "poneyland" ) . key( ) , & "poneyland" ) ;
14
+ if let Entry :: Vacant ( v) = map. entry ( "poneyland" ) {
15
+ v. into_key ( ) ;
16
+ //~^ ERROR: MSRV is `1.3.0` but this item is stable since `1.12.0`
17
+ }
18
+ // Should warn for `sleep` but not for `Duration` (which was added in `1.3.0`).
19
+ sleep ( Duration :: new ( 1 , 0 ) ) ;
20
+ //~^ ERROR: MSRV is `1.3.0` but this item is stable since `1.4.0`
21
+ }
22
+
23
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: MSRV is `1.3.0` but this item is stable since `1.10.0`
2
+ --> $DIR/incompatible_msrv.rs:13:39
3
+ |
4
+ LL | assert_eq!(map.entry("poneyland").key(), &"poneyland");
5
+ | ^^^^^
6
+ |
7
+ = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
8
+ = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
9
+
10
+ error: MSRV is `1.3.0` but this item is stable since `1.12.0`
11
+ --> $DIR/incompatible_msrv.rs:15:11
12
+ |
13
+ LL | v.into_key();
14
+ | ^^^^^^^^^^
15
+
16
+ error: MSRV is `1.3.0` but this item is stable since `1.4.0`
17
+ --> $DIR/incompatible_msrv.rs:19:5
18
+ |
19
+ LL | sleep(Duration::new(1, 0));
20
+ | ^^^^^
21
+
22
+ error: aborting due to 3 previous errors
23
+
You can’t perform that action at this time.
0 commit comments