File tree 3 files changed +8
-10
lines changed
3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ large_stack_arrays = "warn"
99
99
large_types_passed_by_value = " warn"
100
100
linkedlist = " warn"
101
101
macro_use_imports = " warn"
102
- manual_assert = " allow "
102
+ manual_assert = " warn "
103
103
manual_instant_elapsed = " warn"
104
104
manual_is_power_of_two = " warn"
105
105
manual_is_variant_and = " warn"
Original file line number Diff line number Diff line change @@ -35,14 +35,11 @@ impl Position {
35
35
///
36
36
/// Line or column are zero.
37
37
pub const fn new ( line : usize , col : usize ) -> Self {
38
- if line == 0 {
39
- panic ! ( "Line must not be zero" ) ;
40
- }
38
+ // assert_ne not available in constfn
39
+ assert ! ( line != 0 , "line must not be zero" , ) ;
41
40
// Safety: Checked above
42
41
let line = unsafe { NonZeroUsize :: new_unchecked ( line) } ;
43
- if col == 0 {
44
- panic ! ( "Column must not be zero" ) ;
45
- }
42
+ assert ! ( col != 0 , "column must not be zero" , ) ;
46
43
// Safety: Checked above
47
44
let col = unsafe { NonZeroUsize :: new_unchecked ( col) } ;
48
45
Self { line, col }
Original file line number Diff line number Diff line change @@ -620,9 +620,10 @@ fn main() {
620
620
) {
621
621
Ok ( _) => panic ! ( "Accepted faulty program" ) ,
622
622
Err ( error) => {
623
- if !error. contains ( "Expected expression of type `bool`, found type `()`" ) {
624
- panic ! ( "Unexpected error: {error}" )
625
- }
623
+ assert ! (
624
+ error. contains( "Expected expression of type `bool`, found type `()`" ) ,
625
+ "Unexpected error: {error}" ,
626
+ ) ;
626
627
}
627
628
}
628
629
}
You can’t perform that action at this time.
0 commit comments