1 #![warn(clippy::unwrap_in_result)]
6 // should not be detected
7 fn good_divisible_by_3(i_str: String) -> Result<bool, String> {
8 // checks whether a string represents a number divisible by 3
9 let i_result = i_str.parse::<i32>();
11 Err(_e) => Err("Not a number".to_string()),
16 Err("Number is not divisible by 3".to_string())
22 fn bad_divisible_by_3(i_str: String) -> Result<bool, String> {
23 // checks whether a string represents a number divisible by 3
24 let i = i_str.parse::<i32>().unwrap();
28 Err("Number is not divisible by 3".to_string())
32 fn example_option_expect(i_str: String) -> Option<bool> {
33 let i = i_str.parse::<i32>().expect("not a number");
42 A::bad_divisible_by_3("3".to_string());
43 A::good_divisible_by_3("3".to_string());