fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: used unwrap or expect in a function that returns result or option 2 --> $DIR/unwrap_in_result.rs:22:5 3 | 4LL | / fn bad_divisible_by_3(i_str: String) -> Result<bool, String> { 5LL | | 6LL | | // checks whether a string represents a number divisible by 3 7LL | | let i = i_str.parse::<i32>().unwrap(); 8... | 9LL | | } 10LL | | } 11 | |_____^ 12 | 13 = help: unwrap and expect should not be used in a function that returns result or option 14note: potential non-recoverable error(s) 15 --> $DIR/unwrap_in_result.rs:25:17 16 | 17LL | let i = i_str.parse::<i32>().unwrap(); 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 = note: `-D clippy::unwrap-in-result` implied by `-D warnings` 20 = help: to override `-D warnings` add `#[allow(clippy::unwrap_in_result)]` 21 22error: used unwrap or expect in a function that returns result or option 23 --> $DIR/unwrap_in_result.rs:33:5 24 | 25LL | / fn example_option_expect(i_str: String) -> Option<bool> { 26LL | | 27LL | | let i = i_str.parse::<i32>().expect("not a number"); 28LL | | if i % 3 == 0 { 29... | 30LL | | None 31LL | | } 32 | |_____^ 33 | 34 = help: unwrap and expect should not be used in a function that returns result or option 35note: potential non-recoverable error(s) 36 --> $DIR/unwrap_in_result.rs:35:17 37 | 38LL | let i = i_str.parse::<i32>().expect("not a number"); 39 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 40 41error: aborting due to 2 previous errors 42