mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-23 13:13:17 +00:00
fix reviewer comments: tests results
This commit is contained in:
parent
342ce3da05
commit
3991dd10b5
@ -110,16 +110,26 @@ const fn issue6067() {
|
||||
}
|
||||
|
||||
fn issue10726() {
|
||||
Ok::<i32, i32>(42).is_ok();
|
||||
// This is optional, but it makes the examples easier
|
||||
let x: Result<i32, i32> = Ok(42);
|
||||
|
||||
Ok::<i32, i32>(42).is_err();
|
||||
x.is_ok();
|
||||
|
||||
Err::<i32, i32>(42).is_ok();
|
||||
x.is_err();
|
||||
|
||||
Err::<i32, i32>(42).is_err();
|
||||
x.is_err();
|
||||
|
||||
match Ok::<i32, i32>(42) {
|
||||
Ok(21) => true,
|
||||
_ => false,
|
||||
x.is_ok();
|
||||
|
||||
// Don't lint
|
||||
match x {
|
||||
Err(16) => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
// Don't lint
|
||||
match x {
|
||||
Ok(16) => false,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
@ -128,28 +128,38 @@ const fn issue6067() {
|
||||
}
|
||||
|
||||
fn issue10726() {
|
||||
match Ok::<i32, i32>(42) {
|
||||
// This is optional, but it makes the examples easier
|
||||
let x: Result<i32, i32> = Ok(42);
|
||||
|
||||
match x {
|
||||
Ok(_) => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
match Ok::<i32, i32>(42) {
|
||||
match x {
|
||||
Ok(_) => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
match x {
|
||||
Err(_) => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
match Err::<i32, i32>(42) {
|
||||
Ok(_) => true,
|
||||
_ => false,
|
||||
match x {
|
||||
Err(_) => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
match Err::<i32, i32>(42) {
|
||||
Err(_) => true,
|
||||
_ => false,
|
||||
// Don't lint
|
||||
match x {
|
||||
Err(16) => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
match Ok::<i32, i32>(42) {
|
||||
Ok(21) => true,
|
||||
_ => false,
|
||||
// Don't lint
|
||||
match x {
|
||||
Ok(16) => false,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
@ -151,40 +151,40 @@ LL | | };
|
||||
| |_____^ help: try this: `Err::<i32, i32>(42).is_err()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ok()`
|
||||
--> $DIR/redundant_pattern_matching_result.rs:131:5
|
||||
--> $DIR/redundant_pattern_matching_result.rs:134:5
|
||||
|
|
||||
LL | / match Ok::<i32, i32>(42) {
|
||||
LL | / match x {
|
||||
LL | | Ok(_) => true,
|
||||
LL | | _ => false,
|
||||
LL | | };
|
||||
| |_____^ help: try this: `Ok::<i32, i32>(42).is_ok()`
|
||||
| |_____^ help: try this: `x.is_ok()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_err()`
|
||||
--> $DIR/redundant_pattern_matching_result.rs:136:5
|
||||
--> $DIR/redundant_pattern_matching_result.rs:139:5
|
||||
|
|
||||
LL | / match Ok::<i32, i32>(42) {
|
||||
LL | / match x {
|
||||
LL | | Ok(_) => false,
|
||||
LL | | _ => true,
|
||||
LL | | };
|
||||
| |_____^ help: try this: `x.is_err()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_err()`
|
||||
--> $DIR/redundant_pattern_matching_result.rs:144:5
|
||||
|
|
||||
LL | / match x {
|
||||
LL | | Err(_) => true,
|
||||
LL | | _ => false,
|
||||
LL | | };
|
||||
| |_____^ help: try this: `Ok::<i32, i32>(42).is_err()`
|
||||
| |_____^ help: try this: `x.is_err()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_ok()`
|
||||
--> $DIR/redundant_pattern_matching_result.rs:141:5
|
||||
--> $DIR/redundant_pattern_matching_result.rs:149:5
|
||||
|
|
||||
LL | / match Err::<i32, i32>(42) {
|
||||
LL | | Ok(_) => true,
|
||||
LL | | _ => false,
|
||||
LL | / match x {
|
||||
LL | | Err(_) => false,
|
||||
LL | | _ => true,
|
||||
LL | | };
|
||||
| |_____^ help: try this: `Err::<i32, i32>(42).is_ok()`
|
||||
|
||||
error: redundant pattern matching, consider using `is_err()`
|
||||
--> $DIR/redundant_pattern_matching_result.rs:146:5
|
||||
|
|
||||
LL | / match Err::<i32, i32>(42) {
|
||||
LL | | Err(_) => true,
|
||||
LL | | _ => false,
|
||||
LL | | };
|
||||
| |_____^ help: try this: `Err::<i32, i32>(42).is_err()`
|
||||
| |_____^ help: try this: `x.is_ok()`
|
||||
|
||||
error: aborting due to 26 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user