File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -100,20 +100,21 @@ to satisfy the conditions required to perform this unsafe operation.
100
100
}
101
101
```
102
102
103
- 2 . In a next step , we have a lint that fires when an unsafe operation is performed
104
- inside an `unsafe fn ` but outside an `unsafe ` block . So , this would trigger the
105
- lint :
103
+ 2 . Optionally , we could add a clippy " correctness " lint to warn about unsafe
104
+ operations inside an `unsafe fn `, but outside an `unsafe ` block . So , this
105
+ would trigger the lint :
106
106
107
107
```rust
108
108
unsafe fn get_unchecked <T >(x : & [T ], i : usize ) -> & T {
109
109
x . get_unchecked (i )
110
110
}
111
111
```
112
112
113
- This gets us into a state where programmers are much less likely to accidentally
114
- perform undesired unsafe operations inside `unsafe fn `.
113
+ 3 . In a next step , we move this lint to rustc proper , make it warn - by - default .
114
+ This gets us into a state where programmers are much less likely to
115
+ accidentally perform undesired unsafe operations inside `unsafe fn `.
115
116
116
- 3 . Even later (in the 2021 edition ), it might be desirable to turn this warning
117
+ 4 . Even later (in the 2021 edition ), it might be desirable to turn this warning
117
118
into an error .
118
119
119
120
# Drawbacks
You can’t perform that action at this time.
0 commit comments