mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 02:23:20 +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() {
|
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) {
|
x.is_ok();
|
||||||
Ok(21) => true,
|
|
||||||
_ => false,
|
// 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() {
|
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,
|
Ok(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
match Ok::<i32, i32>(42) {
|
match x {
|
||||||
|
Ok(_) => false,
|
||||||
|
_ => true,
|
||||||
|
};
|
||||||
|
|
||||||
|
match x {
|
||||||
Err(_) => true,
|
Err(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
match Err::<i32, i32>(42) {
|
match x {
|
||||||
Ok(_) => true,
|
Err(_) => false,
|
||||||
_ => false,
|
_ => true,
|
||||||
};
|
};
|
||||||
|
|
||||||
match Err::<i32, i32>(42) {
|
// Don't lint
|
||||||
Err(_) => true,
|
match x {
|
||||||
_ => false,
|
Err(16) => false,
|
||||||
|
_ => true,
|
||||||
};
|
};
|
||||||
|
|
||||||
match Ok::<i32, i32>(42) {
|
// Don't lint
|
||||||
Ok(21) => true,
|
match x {
|
||||||
_ => false,
|
Ok(16) => false,
|
||||||
|
_ => true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -151,40 +151,40 @@ LL | | };
|
|||||||
| |_____^ help: try this: `Err::<i32, i32>(42).is_err()`
|
| |_____^ help: try this: `Err::<i32, i32>(42).is_err()`
|
||||||
|
|
||||||
error: redundant pattern matching, consider using `is_ok()`
|
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 | | Ok(_) => true,
|
||||||
LL | | _ => false,
|
LL | | _ => false,
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____^ help: try this: `Ok::<i32, i32>(42).is_ok()`
|
| |_____^ help: try this: `x.is_ok()`
|
||||||
|
|
||||||
error: redundant pattern matching, consider using `is_err()`
|
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 | | Err(_) => true,
|
||||||
LL | | _ => false,
|
LL | | _ => false,
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____^ help: try this: `Ok::<i32, i32>(42).is_err()`
|
| |_____^ help: try this: `x.is_err()`
|
||||||
|
|
||||||
error: redundant pattern matching, consider using `is_ok()`
|
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 | / match x {
|
||||||
LL | | Ok(_) => true,
|
LL | | Err(_) => false,
|
||||||
LL | | _ => false,
|
LL | | _ => true,
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____^ help: try this: `Err::<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:146:5
|
|
||||||
|
|
|
||||||
LL | / match Err::<i32, i32>(42) {
|
|
||||||
LL | | Err(_) => true,
|
|
||||||
LL | | _ => false,
|
|
||||||
LL | | };
|
|
||||||
| |_____^ help: try this: `Err::<i32, i32>(42).is_err()`
|
|
||||||
|
|
||||||
error: aborting due to 26 previous errors
|
error: aborting due to 26 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user