File tree 3 files changed +5
-20
lines changed
3 files changed +5
-20
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use rustc_ast:: ast;
4
4
use rustc_ast:: HasAttrs ;
5
- use rustc_span:: { symbol:: sym, Span , Symbol } ;
5
+ use rustc_span:: { symbol:: sym, Span } ;
6
6
7
7
use self :: doc_comment:: DocCommentFormatter ;
8
8
use crate :: comment:: { contains_comment, rewrite_doc_comment, CommentStyle } ;
@@ -19,20 +19,6 @@ use crate::utils::{count_newlines, mk_sp};
19
19
20
20
mod doc_comment;
21
21
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
-
36
22
/// Returns attributes on the given statement.
37
23
pub ( crate ) fn get_attrs_from_stmt ( stmt : & ast:: Stmt ) -> & [ ast:: Attribute ] {
38
24
stmt. attrs ( )
Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
2
2
use std:: path:: { Path , PathBuf } ;
3
3
4
4
use rustc_ast:: token:: TokenKind ;
5
- use rustc_ast:: { ast, ptr} ;
5
+ use rustc_ast:: { ast, attr , ptr} ;
6
6
use rustc_errors:: Diagnostic ;
7
7
use rustc_parse:: { new_parser_from_file, parser:: Parser as RawParser } ;
8
8
use rustc_span:: { sym, Span } ;
9
9
use thin_vec:: ThinVec ;
10
10
11
- use crate :: attr:: first_attr_value_str_by_name;
12
11
use crate :: parse:: session:: ParseSess ;
13
12
use crate :: Input ;
14
13
@@ -93,7 +92,7 @@ pub(crate) enum ParserError {
93
92
94
93
impl < ' a > Parser < ' a > {
95
94
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) ?;
97
96
let path_str = path_sym. as_str ( ) ;
98
97
99
98
// On windows, the base path might have the form
Original file line number Diff line number Diff line change 8
8
9
9
use std:: cmp:: { Ord , Ordering } ;
10
10
11
- use rustc_ast:: ast;
11
+ use rustc_ast:: { ast, attr } ;
12
12
use rustc_span:: { symbol:: sym, Span } ;
13
13
14
14
use crate :: config:: { Config , GroupImportsTactic } ;
@@ -167,7 +167,7 @@ fn rewrite_reorderable_or_regroupable_items(
167
167
}
168
168
169
169
fn 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)
171
171
}
172
172
173
173
/// Divides imports into three groups, corresponding to standard, external
You can’t perform that action at this time.
0 commit comments