File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -189,12 +189,21 @@ impl Parse for IgnoreDirsWithSpan {
189189 let mut dirs = Vec :: new ( ) ;
190190 while !inner_content. is_empty ( ) {
191191 let directory_span = inner_content. span ( ) ;
192- let directory_str = inner_content. parse :: < LitStr > ( ) ?;
192+ if let Ok ( directory_str) = inner_content. parse :: < LitStr > ( ) {
193+ let path = PathBuf :: from ( directory_str. value ( ) ) ;
194+ dirs. push ( ( path, directory_span) ) ;
195+ } else if let Ok ( directory_ident) = inner_content. parse :: < Ident > ( ) {
196+ let path = PathBuf :: from ( directory_ident. to_string ( ) ) ;
197+ dirs. push ( ( path, directory_span) ) ;
198+ } else {
199+ return Err ( syn:: Error :: new (
200+ directory_span,
201+ "Ignored directory must be a literal string or valid identifier" ,
202+ ) ) ;
203+ }
193204 if !inner_content. is_empty ( ) {
194205 inner_content. parse :: < Token ! [ , ] > ( ) ?;
195206 }
196- let path = PathBuf :: from ( directory_str. value ( ) ) ;
197- dirs. push ( ( path, directory_span) ) ;
198207 }
199208
200209 Ok ( IgnoreDirsWithSpan ( dirs) )
You can’t perform that action at this time.
0 commit comments