1
Fork 0

Replace unreachable panics with unreachable!().

This commit is contained in:
Bauke 2022-04-08 22:54:17 +02:00
parent 491e7c743a
commit 15ac4ec45c
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
3 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ pub fn roman_to_int(string: String) -> i32 {
'C' => 100, 'C' => 100,
'D' => 500, 'D' => 500,
'M' => 1000, 'M' => 1000,
_ => panic!("Unknown character: {character}"), _ => unreachable!(),
}; };
if let Some(next) = characters.peek() { if let Some(next) = characters.peek() {

View File

@ -13,5 +13,5 @@ pub fn two_sum(numbers: Vec<i32>, target: i32) -> Vec<i32> {
} }
} }
panic!("No pair of numbers found that sum to {}", target) unreachable!()
} }

View File

@ -10,7 +10,7 @@ pub fn is_valid(string: String) -> bool {
'[' => ']', '[' => ']',
'{' => '}', '{' => '}',
'(' => ')', '(' => ')',
_ => panic!("Invalid input character: {character}"), _ => unreachable!(),
} }
} }