|
60 | 60 | Args = "()",
|
61 | 61 | note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
|
62 | 62 | ),
|
| 63 | + on( |
| 64 | + _Self = "unsafe fn", |
| 65 | + note = "unsafe function cannot be called generically without an unsafe block", |
| 66 | + // SAFETY: tidy is not smart enough to tell that the below unsafe block is a string |
| 67 | + label = "call the function in a closure: `|| unsafe {{ /* code */ }}`" |
| 68 | + ), |
63 | 69 | message = "expected a `{Fn}<{Args}>` closure, found `{Self}`",
|
64 | 70 | label = "expected an `Fn<{Args}>` closure, found `{Self}`"
|
65 | 71 | )]
|
@@ -141,6 +147,12 @@ pub trait Fn<Args>: FnMut<Args> {
|
141 | 147 | Args = "()",
|
142 | 148 | note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
|
143 | 149 | ),
|
| 150 | + on( |
| 151 | + _Self = "unsafe fn", |
| 152 | + note = "unsafe function cannot be called generically without an unsafe block", |
| 153 | + // SAFETY: tidy is not smart enough to tell that the below unsafe block is a string |
| 154 | + label = "call the function in a closure: `|| unsafe {{ /* code */ }}`" |
| 155 | + ), |
144 | 156 | message = "expected a `{FnMut}<{Args}>` closure, found `{Self}`",
|
145 | 157 | label = "expected an `FnMut<{Args}>` closure, found `{Self}`"
|
146 | 158 | )]
|
@@ -214,6 +226,12 @@ pub trait FnMut<Args>: FnOnce<Args> {
|
214 | 226 | Args = "()",
|
215 | 227 | note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
|
216 | 228 | ),
|
| 229 | + on( |
| 230 | + _Self = "unsafe fn", |
| 231 | + note = "unsafe function cannot be called generically without an unsafe block", |
| 232 | + // SAFETY: tidy is not smart enough to tell that the below unsafe block is a string |
| 233 | + label = "call the function in a closure: `|| unsafe {{ /* code */ }}`" |
| 234 | + ), |
217 | 235 | message = "expected a `{FnOnce}<{Args}>` closure, found `{Self}`",
|
218 | 236 | label = "expected an `FnOnce<{Args}>` closure, found `{Self}`"
|
219 | 237 | )]
|
|
0 commit comments