File tree Expand file tree Collapse file tree 3 files changed +5
-20
lines changed Expand file tree Collapse file tree 3 files changed +5
-20
lines changed Original file line number Diff line number Diff line change 22
33use  rustc_ast:: ast; 
44use  rustc_ast:: HasAttrs ; 
5- use  rustc_span:: { symbol:: sym,  Span ,   Symbol } ; 
5+ use  rustc_span:: { symbol:: sym,  Span } ; 
66
77use  self :: doc_comment:: DocCommentFormatter ; 
88use  crate :: comment:: { contains_comment,  rewrite_doc_comment,  CommentStyle } ; 
@@ -19,20 +19,6 @@ use crate::utils::{count_newlines, mk_sp};
1919
2020mod  doc_comment; 
2121
22- pub ( crate )  fn  contains_name ( attrs :  & [ ast:: Attribute ] ,  name :  Symbol )  -> bool  { 
23-  attrs. iter ( ) . any ( |attr| attr. has_name ( name) ) 
24- } 
25- 
26- pub ( crate )  fn  first_attr_value_str_by_name ( 
27-  attrs :  & [ ast:: Attribute ] , 
28-  name :  Symbol , 
29- )  -> Option < Symbol >  { 
30-  attrs
31-  . iter ( ) 
32-  . find ( |attr| attr. has_name ( name) ) 
33-  . and_then ( |attr| attr. value_str ( ) ) 
34- } 
35- 
3622/// Returns attributes on the given statement. 
3723pub ( crate )  fn  get_attrs_from_stmt ( stmt :  & ast:: Stmt )  -> & [ ast:: Attribute ]  { 
3824 stmt. attrs ( ) 
Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
22use  std:: path:: { Path ,  PathBuf } ; 
33
44use  rustc_ast:: token:: TokenKind ; 
5- use  rustc_ast:: { ast,  ptr} ; 
5+ use  rustc_ast:: { ast,  attr ,   ptr} ; 
66use  rustc_errors:: Diagnostic ; 
77use  rustc_parse:: { new_parser_from_file,  parser:: Parser  as  RawParser } ; 
88use  rustc_span:: { sym,  Span } ; 
99use  thin_vec:: ThinVec ; 
1010
11- use  crate :: attr:: first_attr_value_str_by_name; 
1211use  crate :: parse:: session:: ParseSess ; 
1312use  crate :: Input ; 
1413
@@ -93,7 +92,7 @@ pub(crate) enum ParserError {
9392
9493impl < ' a >  Parser < ' a >  { 
9594 pub ( crate )  fn  submod_path_from_attr ( attrs :  & [ ast:: Attribute ] ,  path :  & Path )  -> Option < PathBuf >  { 
96-  let  path_sym = first_attr_value_str_by_name ( attrs,  sym:: path) ?; 
95+  let  path_sym = attr :: first_attr_value_str_by_name ( attrs,  sym:: path) ?; 
9796 let  path_str = path_sym. as_str ( ) ; 
9897
9998 // On windows, the base path might have the form 
Original file line number Diff line number Diff line change 88
99use  std:: cmp:: { Ord ,  Ordering } ; 
1010
11- use  rustc_ast:: ast; 
11+ use  rustc_ast:: { ast,  attr } ; 
1212use  rustc_span:: { symbol:: sym,  Span } ; 
1313
1414use  crate :: config:: { Config ,  GroupImportsTactic } ; 
@@ -167,7 +167,7 @@ fn rewrite_reorderable_or_regroupable_items(
167167} 
168168
169169fn  contains_macro_use_attr ( item :  & ast:: Item )  -> bool  { 
170-  crate :: attr:: contains_name ( & item. attrs ,  sym:: macro_use) 
170+  attr:: contains_name ( & item. attrs ,  sym:: macro_use) 
171171} 
172172
173173/// Divides imports into three groups, corresponding to standard, external 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments