@@ -844,7 +844,6 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
844844 "forbid" ,
845845 "cold" ,
846846 ] ;
847- let cortex_m_rt_blacklist = & [ "entry" , "exception" , "interrupt" , "pre_init" ] ;
848847
849848 ' o: for attr in attrs {
850849 for val in whitelist {
@@ -853,35 +852,22 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
853852 }
854853 }
855854
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"
876859 }
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+ } ;
878867
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 ( ) ) ;
885871 }
886872
887873 Ok ( ( ) )
0 commit comments