Replace unreachable panics with unreachable!().
This commit is contained in:
		
							parent
							
								
									491e7c743a
								
							
						
					
					
						commit
						15ac4ec45c
					
				| 
						 | 
				
			
			@ -11,7 +11,7 @@ pub fn roman_to_int(string: String) -> i32 {
 | 
			
		|||
      'C' => 100,
 | 
			
		||||
      'D' => 500,
 | 
			
		||||
      'M' => 1000,
 | 
			
		||||
      _ => panic!("Unknown character: {character}"),
 | 
			
		||||
      _ => unreachable!(),
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if let Some(next) = characters.peek() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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!()
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ pub fn is_valid(string: String) -> bool {
 | 
			
		|||
      '[' => ']',
 | 
			
		||||
      '{' => '}',
 | 
			
		||||
      '(' => ')',
 | 
			
		||||
      _ => panic!("Invalid input character: {character}"),
 | 
			
		||||
      _ => unreachable!(),
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue