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