1 error: consider implementing `TryFrom` instead
2 --> $DIR/fallible_impl_from.rs:6:1
4 LL | / impl From<String> for Foo {
5 LL | | fn from(s: String) -> Self {
6 LL | | Foo(s.parse().unwrap())
11 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
12 note: potential failure(s)
13 --> $DIR/fallible_impl_from.rs:8:13
15 LL | Foo(s.parse().unwrap())
17 note: the lint level is defined here
18 --> $DIR/fallible_impl_from.rs:1:9
20 LL | #![deny(clippy::fallible_impl_from)]
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
23 error: consider implementing `TryFrom` instead
24 --> $DIR/fallible_impl_from.rs:27:1
26 LL | / impl From<usize> for Invalid {
27 LL | | fn from(i: usize) -> Invalid {
35 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
36 note: potential failure(s)
37 --> $DIR/fallible_impl_from.rs:30:13
41 = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
43 error: consider implementing `TryFrom` instead
44 --> $DIR/fallible_impl_from.rs:36:1
46 LL | / impl From<Option<String>> for Invalid {
47 LL | | fn from(s: Option<String>) -> Invalid {
48 LL | | let s = s.unwrap();
49 LL | | if !s.is_empty() {
55 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
56 note: potential failure(s)
57 --> $DIR/fallible_impl_from.rs:38:17
59 LL | let s = s.unwrap();
61 LL | if !s.is_empty() {
64 LL | } else if s.parse::<u32>().unwrap() != 42 {
65 | ^^^^^^^^^^^^^^^^^^^^^^^^^
66 LL | panic!("{:?}", s);
68 = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
70 error: consider implementing `TryFrom` instead
71 --> $DIR/fallible_impl_from.rs:54:1
73 LL | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
74 LL | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
75 LL | | if s.parse::<u32>().ok().unwrap() != 42 {
76 LL | | panic!("{:?}", s);
82 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
83 note: potential failure(s)
84 --> $DIR/fallible_impl_from.rs:56:12
86 LL | if s.parse::<u32>().ok().unwrap() != 42 {
87 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 LL | panic!("{:?}", s);
90 = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
92 error: aborting due to 4 previous errors