mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Add msrv tests
This commit is contained in:
parent
354172a18e
commit
24039ca2c6
@ -82,3 +82,19 @@ fn main() {
|
||||
[1, 2, 3].iter().try_fold(0i32, |sum, i| sum.checked_add(*i)).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.26.0"]
|
||||
fn msrv_too_low() {
|
||||
[1, 2, 3]
|
||||
.iter()
|
||||
.fold(Some(0i32), |sum, i| sum?.checked_add(*i))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.27.0"]
|
||||
fn msrv_juust_right() {
|
||||
[1, 2, 3]
|
||||
.iter()
|
||||
.fold(Some(0i32), |sum, i| sum?.checked_add(*i))
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -18,5 +18,11 @@ error: you seem to be using `Iterator::fold` on a type that implements `Try`
|
||||
LL | .fold(NotOptionButWorse(0i32), |sum, i| NotOptionButWorse(0i32));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i|, ...)`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: you seem to be using `Iterator::fold` on a type that implements `Try`
|
||||
--> $DIR/manual_try_fold.rs:98:10
|
||||
|
|
||||
LL | .fold(Some(0i32), |sum, i| sum?.checked_add(*i))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `try_fold` instead: `try_fold(0i32, |sum, i|, ...)`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user