This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -211,22 +211,26 @@ fn get_functions(files: &[syn::File]) -> Vec<FnSig> {
211
211
syn_to_str!( generics. clone( ) )
212
212
) ) ;
213
213
}
214
- // FIXME: we can do better here, but right now, we should
215
- // error if inline and no_panic are not used, which is the
216
- // case if the public API has no attributes.
217
- //
218
- // We might also want to check other attributes as well.
219
214
if attrs. is_empty ( ) {
220
- let e2 = e;
221
215
err ! ( format!(
222
- "missing `#[inline]` and `#[no_panic]` attributes {}" ,
223
- attrs
224
- . iter( )
225
- . map( |a| syn_to_str!( a) )
226
- . collect:: <Vec <_>>( )
227
- . join( "," )
216
+ "missing `#[inline]` and `#[no_panic]` attributes"
228
217
) ) ;
229
- e = e2;
218
+ } else {
219
+ let attrs = attrs
220
+ . iter ( )
221
+ . map ( |a| syn_to_str ! ( a) )
222
+ . collect :: < Vec < _ > > ( )
223
+ . join ( "," ) ;
224
+ if !attrs. contains ( "inline" ) {
225
+ err ! ( format!(
226
+ "missing `#[inline]` attribute"
227
+ ) ) ;
228
+ }
229
+ if !attrs. contains ( "no_panic" ) {
230
+ err ! ( format!(
231
+ "missing `#[no_panic]` attributes"
232
+ ) ) ;
233
+ }
230
234
}
231
235
// Validate and parse output parameters and function arguments:
232
236
match output {
You can’t perform that action at this time.
0 commit comments