rust/tests/ui/fallible_impl_from.stderr

94 lines
3.2 KiB
Plaintext
Raw Normal View History

2017-10-17 11:09:10 -05:00
error: consider implementing `TryFrom` instead
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:14:1
|
2018-12-09 23:27:19 -06:00
14 | / impl From<String> for Foo {
15 | | fn from(s: String) -> Self {
16 | | Foo(s.parse().unwrap())
17 | | }
18 | | }
| |_^
|
2017-10-17 11:09:10 -05:00
note: lint level defined here
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:10:9
|
2018-12-09 23:27:19 -06:00
10 | #![deny(clippy::fallible_impl_from)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
2017-10-17 11:09:10 -05:00
note: potential failure(s)
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:16:13
|
2018-12-09 23:27:19 -06:00
16 | Foo(s.parse().unwrap())
| ^^^^^^^^^^^^^^^^^^
2017-10-17 11:09:10 -05:00
error: consider implementing `TryFrom` instead
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:35:1
2017-10-17 11:09:10 -05:00
|
2018-12-09 23:27:19 -06:00
35 | / impl From<usize> for Invalid {
36 | | fn from(i: usize) -> Invalid {
37 | | if i != 42 {
38 | | panic!();
2017-10-17 11:09:10 -05:00
... |
2018-12-09 23:27:19 -06:00
41 | | }
42 | | }
2017-10-17 11:09:10 -05:00
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:38:13
2017-10-17 11:09:10 -05:00
|
2018-12-09 23:27:19 -06:00
38 | panic!();
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^
2017-11-29 08:45:12 -06:00
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2017-10-17 11:09:10 -05:00
error: consider implementing `TryFrom` instead
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:44:1
2017-10-17 11:09:10 -05:00
|
2018-12-09 23:27:19 -06:00
44 | / impl From<Option<String>> for Invalid {
45 | | fn from(s: Option<String>) -> Invalid {
46 | | let s = s.unwrap();
47 | | if !s.is_empty() {
2017-10-17 11:09:10 -05:00
... |
2018-12-09 23:27:19 -06:00
53 | | }
54 | | }
2017-10-17 11:09:10 -05:00
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:46:17
2017-10-17 11:09:10 -05:00
|
2018-12-09 23:27:19 -06:00
46 | let s = s.unwrap();
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^^
2018-12-09 23:27:19 -06:00
47 | if !s.is_empty() {
48 | panic!(42);
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^^^
2018-12-09 23:27:19 -06:00
49 | } else if s.parse::<u32>().unwrap() != 42 {
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2018-12-09 23:27:19 -06:00
50 | panic!("{:?}", s);
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^^^^^^^^^^
2017-11-29 08:45:12 -06:00
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2017-10-17 11:09:10 -05:00
error: consider implementing `TryFrom` instead
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:62:1
2017-10-17 11:09:10 -05:00
|
2018-12-09 23:27:19 -06:00
62 | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
63 | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
64 | | if s.parse::<u32>().ok().unwrap() != 42 {
65 | | panic!("{:?}", s);
2017-10-17 11:09:10 -05:00
... |
2018-12-09 23:27:19 -06:00
68 | | }
69 | | }
2017-10-17 11:09:10 -05:00
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
2018-12-09 23:27:19 -06:00
--> $DIR/fallible_impl_from.rs:64:12
2017-10-17 11:09:10 -05:00
|
2018-12-09 23:27:19 -06:00
64 | if s.parse::<u32>().ok().unwrap() != 42 {
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2018-12-09 23:27:19 -06:00
65 | panic!("{:?}", s);
2017-10-17 11:09:10 -05:00
| ^^^^^^^^^^^^^^^^^^
2017-11-29 08:45:12 -06:00
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2017-10-17 11:09:10 -05:00
2018-01-16 10:06:27 -06:00
error: aborting due to 4 previous errors