fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: consider implementing `TryFrom` instead 2 --> $DIR/fallible_impl_from.rs:6:1 3 | 4LL | / impl From<String> for Foo { 5LL | | 6LL | | fn from(s: String) -> Self { 7LL | | Foo(s.parse().unwrap()) 8LL | | } 9LL | | } 10 | |_^ 11 | 12 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail 13note: potential failure(s) 14 --> $DIR/fallible_impl_from.rs:9:13 15 | 16LL | Foo(s.parse().unwrap()) 17 | ^^^^^^^^^^^^^^^^^^ 18note: the lint level is defined here 19 --> $DIR/fallible_impl_from.rs:1:9 20 | 21LL | #![deny(clippy::fallible_impl_from)] 22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 24error: consider implementing `TryFrom` instead 25 --> $DIR/fallible_impl_from.rs:28:1 26 | 27LL | / impl From<usize> for Invalid { 28LL | | 29LL | | fn from(i: usize) -> Invalid { 30LL | | if i != 42 { 31... | 32LL | | } 33LL | | } 34 | |_^ 35 | 36 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail 37note: potential failure(s) 38 --> $DIR/fallible_impl_from.rs:32:13 39 | 40LL | panic!(); 41 | ^^^^^^^^ 42 = 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 44error: consider implementing `TryFrom` instead 45 --> $DIR/fallible_impl_from.rs:38:1 46 | 47LL | / impl From<Option<String>> for Invalid { 48LL | | 49LL | | fn from(s: Option<String>) -> Invalid { 50LL | | let s = s.unwrap(); 51... | 52LL | | } 53LL | | } 54 | |_^ 55 | 56 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail 57note: potential failure(s) 58 --> $DIR/fallible_impl_from.rs:41:17 59 | 60LL | let s = s.unwrap(); 61 | ^^^^^^^^^^ 62LL | if !s.is_empty() { 63LL | panic!("42"); 64 | ^^^^^^^^^^^^ 65LL | } else if s.parse::<u32>().unwrap() != 42 { 66 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 67LL | panic!("{:?}", s); 68 | ^^^^^^^^^^^^^^^^^ 69 = 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 71error: consider implementing `TryFrom` instead 72 --> $DIR/fallible_impl_from.rs:57:1 73 | 74LL | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid { 75LL | | 76LL | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid { 77LL | | if s.parse::<u32>().ok().unwrap() != 42 { 78... | 79LL | | } 80LL | | } 81 | |_^ 82 | 83 = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail 84note: potential failure(s) 85 --> $DIR/fallible_impl_from.rs:60:12 86 | 87LL | if s.parse::<u32>().ok().unwrap() != 42 { 88 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 89LL | panic!("{:?}", s); 90 | ^^^^^^^^^^^^^^^^^ 91 = 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 93error: aborting due to 4 previous errors 94