@@ -844,7 +844,6 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
844
844
"forbid" ,
845
845
"cold" ,
846
846
] ;
847
- let cortex_m_rt_blacklist = & [ "entry" , "exception" , "interrupt" , "pre_init" ] ;
848
847
849
848
' o: for attr in attrs {
850
849
for val in whitelist {
@@ -853,35 +852,22 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
853
852
}
854
853
}
855
854
856
- for val in cortex_m_rt_blacklist {
857
- if eq ( & attr, & val) {
858
- let err_str = match caller {
859
- WhiteListCaller :: Entry => {
860
- & "this attribute is not allowed on a cortex-m-rt entry point"
861
- }
862
- WhiteListCaller :: Exception => {
863
- & "this attribute is not allowed on an exception handler"
864
- }
865
- WhiteListCaller :: Interrupt => {
866
- & "this attribute is not allowed on an interrupt handler"
867
- }
868
- WhiteListCaller :: PreInit => {
869
- & "this attribute is not allowed on an interrupt handler"
870
- }
871
- } ;
872
-
873
- return Err ( parse:: Error :: new ( attr. span ( ) , err_str)
874
- . to_compile_error ( )
875
- . into ( ) ) ;
855
+ let err_str = match caller {
856
+ WhiteListCaller :: Entry => "this attribute is not allowed on a cortex-m-rt entry point" ,
857
+ WhiteListCaller :: Exception => {
858
+ "this attribute is not allowed on an exception handler controlled by cortex-m-rt"
876
859
}
877
- }
860
+ WhiteListCaller :: Interrupt => {
861
+ "this attribute is not allowed on an interrupt handler controlled by cortex-m-rt"
862
+ }
863
+ WhiteListCaller :: PreInit => {
864
+ "this attribute is not allowed on a pre-init controlled by cortex-m-rt"
865
+ }
866
+ } ;
878
867
879
- return Err ( parse:: Error :: new (
880
- attr. span ( ) ,
881
- "this attribute is not allowed on a function controlled by cortex-m-rt" ,
882
- )
883
- . to_compile_error ( )
884
- . into ( ) ) ;
868
+ return Err ( parse:: Error :: new ( attr. span ( ) , & err_str)
869
+ . to_compile_error ( )
870
+ . into ( ) ) ;
885
871
}
886
872
887
873
Ok ( ( ) )
0 commit comments