Skip to content

Commit 2dc5d52

Browse files
committed
Remove needless error in test
1 parent 3a19df2 commit 2dc5d52

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// compile-flags: --test
22

3-
use std::num::ParseIntError;
3+
use std::num::ParseFloatError;
44

55
#[test]
6-
fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> { //~ ERROR
7-
"0".parse() //~ ERROR type mismatch resolving
6+
fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { //~ ERROR
7+
"0".parse()
88
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
1-
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseIntError>`
1+
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseFloatError>`
22
--> $DIR/termination-trait-test-wrong-type.rs:6:1
33
|
4-
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> {
4+
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> {
55
LL | | "0".parse()
66
LL | | }
77
| |_^ `main` can only return types that implement `std::process::Termination`
88
|
9-
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseIntError>`
9+
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseFloatError>`
1010
= note: required by `test::assert_test_result`
1111

12-
error[E0271]: type mismatch resolving `<f32 as std::str::FromStr>::Err == std::num::ParseIntError`
13-
--> $DIR/termination-trait-test-wrong-type.rs:7:9
14-
|
15-
LL | "0".parse()
16-
| ^^^^^ expected struct `std::num::ParseFloatError`, found struct `std::num::ParseIntError`
17-
|
18-
= note: expected type `std::num::ParseFloatError`
19-
found type `std::num::ParseIntError`
20-
21-
error: aborting due to 2 previous errors
12+
error: aborting due to previous error
2213

23-
Some errors have detailed explanations: E0271, E0277.
24-
For more information about an error, try `rustc --explain E0271`.
14+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)