forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#9688 - Alexendoo:msrv-tests, r=Manishearth
Move MSRV tests into the lint specific test files There are currently two ways MSRV tests are done in the ui test suite, adding a case to the `#![clippy::msrv = "1.0"]` `tests/ui/min_rust_version_attr.rs` or adding the two `msrv_1_xx` functions to the test file of the lint in question This updates the clippy book to suggest the `msrv_1_xx` style, and replaces the tests in `tests/ui/min_rust_version_attr.rs` with ones of that style Almost the entire diff is just moving stuff around as a result, I made sure to check the line numbers the lints are emitted at correspond with the right `msrv` case, so feel free to only skim that part changelog: none
- Loading branch information
Showing
69 changed files
with
1,290 additions
and
632 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
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 |
---|---|---|
@@ -1,106 +1,112 @@ | ||
error: casting the result of `i32::abs()` to u32 | ||
--> $DIR/cast_abs_to_unsigned.rs:7:18 | ||
--> $DIR/cast_abs_to_unsigned.rs:9:18 | ||
| | ||
LL | let y: u32 = x.abs() as u32; | ||
| ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()` | ||
| | ||
= note: `-D clippy::cast-abs-to-unsigned` implied by `-D warnings` | ||
|
||
error: casting the result of `i32::abs()` to usize | ||
--> $DIR/cast_abs_to_unsigned.rs:11:20 | ||
--> $DIR/cast_abs_to_unsigned.rs:13:20 | ||
| | ||
LL | let _: usize = a.abs() as usize; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i32::abs()` to usize | ||
--> $DIR/cast_abs_to_unsigned.rs:12:20 | ||
--> $DIR/cast_abs_to_unsigned.rs:14:20 | ||
| | ||
LL | let _: usize = a.abs() as _; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i32::abs()` to usize | ||
--> $DIR/cast_abs_to_unsigned.rs:13:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:15:13 | ||
| | ||
LL | let _ = a.abs() as usize; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to usize | ||
--> $DIR/cast_abs_to_unsigned.rs:16:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:18:13 | ||
| | ||
LL | let _ = a.abs() as usize; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to u8 | ||
--> $DIR/cast_abs_to_unsigned.rs:17:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:19:13 | ||
| | ||
LL | let _ = a.abs() as u8; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to u16 | ||
--> $DIR/cast_abs_to_unsigned.rs:18:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:20:13 | ||
| | ||
LL | let _ = a.abs() as u16; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to u32 | ||
--> $DIR/cast_abs_to_unsigned.rs:19:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:21:13 | ||
| | ||
LL | let _ = a.abs() as u32; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to u64 | ||
--> $DIR/cast_abs_to_unsigned.rs:20:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:22:13 | ||
| | ||
LL | let _ = a.abs() as u64; | ||
| ^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to u128 | ||
--> $DIR/cast_abs_to_unsigned.rs:21:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:23:13 | ||
| | ||
LL | let _ = a.abs() as u128; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `isize::abs()` to usize | ||
--> $DIR/cast_abs_to_unsigned.rs:24:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:26:13 | ||
| | ||
LL | let _ = a.abs() as usize; | ||
| ^^^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `isize::abs()` to u8 | ||
--> $DIR/cast_abs_to_unsigned.rs:25:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:27:13 | ||
| | ||
LL | let _ = a.abs() as u8; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `isize::abs()` to u16 | ||
--> $DIR/cast_abs_to_unsigned.rs:26:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:28:13 | ||
| | ||
LL | let _ = a.abs() as u16; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `isize::abs()` to u32 | ||
--> $DIR/cast_abs_to_unsigned.rs:27:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:29:13 | ||
| | ||
LL | let _ = a.abs() as u32; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `isize::abs()` to u64 | ||
--> $DIR/cast_abs_to_unsigned.rs:28:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:30:13 | ||
| | ||
LL | let _ = a.abs() as u64; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `isize::abs()` to u128 | ||
--> $DIR/cast_abs_to_unsigned.rs:29:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:31:13 | ||
| | ||
LL | let _ = a.abs() as u128; | ||
| ^^^^^^^ help: replace with: `a.unsigned_abs()` | ||
|
||
error: casting the result of `i64::abs()` to u32 | ||
--> $DIR/cast_abs_to_unsigned.rs:31:13 | ||
--> $DIR/cast_abs_to_unsigned.rs:33:13 | ||
| | ||
LL | let _ = (x as i64 - y as i64).abs() as u32; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `(x as i64 - y as i64).unsigned_abs()` | ||
|
||
error: aborting due to 17 previous errors | ||
error: casting the result of `i32::abs()` to u32 | ||
--> $DIR/cast_abs_to_unsigned.rs:47:23 | ||
| | ||
LL | assert_eq!(10u32, x.abs() as u32); | ||
| ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()` | ||
|
||
error: aborting due to 18 previous errors | ||
|
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 |
---|---|---|
@@ -1,82 +1,88 @@ | ||
error: casting `bool` to `u8` is more cleanly stated with `u8::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:8:13 | ||
--> $DIR/cast_lossless_bool.rs:9:13 | ||
| | ||
LL | let _ = true as u8; | ||
| ^^^^^^^^^^ help: try: `u8::from(true)` | ||
| | ||
= note: `-D clippy::cast-lossless` implied by `-D warnings` | ||
|
||
error: casting `bool` to `u16` is more cleanly stated with `u16::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:9:13 | ||
--> $DIR/cast_lossless_bool.rs:10:13 | ||
| | ||
LL | let _ = true as u16; | ||
| ^^^^^^^^^^^ help: try: `u16::from(true)` | ||
|
||
error: casting `bool` to `u32` is more cleanly stated with `u32::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:10:13 | ||
--> $DIR/cast_lossless_bool.rs:11:13 | ||
| | ||
LL | let _ = true as u32; | ||
| ^^^^^^^^^^^ help: try: `u32::from(true)` | ||
|
||
error: casting `bool` to `u64` is more cleanly stated with `u64::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:11:13 | ||
--> $DIR/cast_lossless_bool.rs:12:13 | ||
| | ||
LL | let _ = true as u64; | ||
| ^^^^^^^^^^^ help: try: `u64::from(true)` | ||
|
||
error: casting `bool` to `u128` is more cleanly stated with `u128::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:12:13 | ||
--> $DIR/cast_lossless_bool.rs:13:13 | ||
| | ||
LL | let _ = true as u128; | ||
| ^^^^^^^^^^^^ help: try: `u128::from(true)` | ||
|
||
error: casting `bool` to `usize` is more cleanly stated with `usize::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:13:13 | ||
--> $DIR/cast_lossless_bool.rs:14:13 | ||
| | ||
LL | let _ = true as usize; | ||
| ^^^^^^^^^^^^^ help: try: `usize::from(true)` | ||
|
||
error: casting `bool` to `i8` is more cleanly stated with `i8::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:15:13 | ||
--> $DIR/cast_lossless_bool.rs:16:13 | ||
| | ||
LL | let _ = true as i8; | ||
| ^^^^^^^^^^ help: try: `i8::from(true)` | ||
|
||
error: casting `bool` to `i16` is more cleanly stated with `i16::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:16:13 | ||
--> $DIR/cast_lossless_bool.rs:17:13 | ||
| | ||
LL | let _ = true as i16; | ||
| ^^^^^^^^^^^ help: try: `i16::from(true)` | ||
|
||
error: casting `bool` to `i32` is more cleanly stated with `i32::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:17:13 | ||
--> $DIR/cast_lossless_bool.rs:18:13 | ||
| | ||
LL | let _ = true as i32; | ||
| ^^^^^^^^^^^ help: try: `i32::from(true)` | ||
|
||
error: casting `bool` to `i64` is more cleanly stated with `i64::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:18:13 | ||
--> $DIR/cast_lossless_bool.rs:19:13 | ||
| | ||
LL | let _ = true as i64; | ||
| ^^^^^^^^^^^ help: try: `i64::from(true)` | ||
|
||
error: casting `bool` to `i128` is more cleanly stated with `i128::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:19:13 | ||
--> $DIR/cast_lossless_bool.rs:20:13 | ||
| | ||
LL | let _ = true as i128; | ||
| ^^^^^^^^^^^^ help: try: `i128::from(true)` | ||
|
||
error: casting `bool` to `isize` is more cleanly stated with `isize::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:20:13 | ||
--> $DIR/cast_lossless_bool.rs:21:13 | ||
| | ||
LL | let _ = true as isize; | ||
| ^^^^^^^^^^^^^ help: try: `isize::from(true)` | ||
|
||
error: casting `bool` to `u16` is more cleanly stated with `u16::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:23:13 | ||
--> $DIR/cast_lossless_bool.rs:24:13 | ||
| | ||
LL | let _ = (true | false) as u16; | ||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::from(true | false)` | ||
|
||
error: aborting due to 13 previous errors | ||
error: casting `bool` to `u8` is more cleanly stated with `u8::from(_)` | ||
--> $DIR/cast_lossless_bool.rs:54:13 | ||
| | ||
LL | let _ = true as u8; | ||
| ^^^^^^^^^^ help: try: `u8::from(true)` | ||
|
||
error: aborting due to 14 previous errors | ||
|
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
Oops, something went wrong.