File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ fn compare_items(a: &ast::Item, b: &ast::Item) -> Ordering {
3131 ( & ast:: ItemKind :: ExternCrate ( ref a_name) , & ast:: ItemKind :: ExternCrate ( ref b_name) ) => {
3232 // `extern crate foo as bar;`
3333 // ^^^ Comparing this.
34- let a_orig_name = a_name. map_or_else ( || a. ident . as_str ( ) , rustc_span :: Symbol :: as_str ) ;
35- let b_orig_name = b_name. map_or_else ( || b. ident . as_str ( ) , rustc_span :: Symbol :: as_str ) ;
36- let result = a_orig_name. cmp ( & b_orig_name) ;
34+ let a_orig_name = a_name. unwrap_or ( a. ident . name ) ;
35+ let b_orig_name = b_name. unwrap_or ( b. ident . name ) ;
36+ let result = a_orig_name. as_str ( ) . cmp ( b_orig_name. as_str ( ) ) ;
3737 if result != Ordering :: Equal {
3838 return result;
3939 }
Original file line number Diff line number Diff line change @@ -95,15 +95,17 @@ pub(crate) enum ParserError {
9595
9696impl < ' a > Parser < ' a > {
9797 pub ( crate ) fn submod_path_from_attr ( attrs : & [ ast:: Attribute ] , path : & Path ) -> Option < PathBuf > {
98- let path_string = first_attr_value_str_by_name ( attrs, sym:: path) ?. as_str ( ) ;
98+ let path_sym = first_attr_value_str_by_name ( attrs, sym:: path) ?;
99+ let path_str = path_sym. as_str ( ) ;
100+
99101 // On windows, the base path might have the form
100102 // `\\?\foo\bar` in which case it does not tolerate
101103 // mixed `/` and `\` separators, so canonicalize
102104 // `/` to `\`.
103105 #[ cfg( windows) ]
104- let path_string = path_string . replace ( "/" , "\\ " ) ;
106+ let path_str = path_str . replace ( "/" , "\\ " ) ;
105107
106- Some ( path. join ( & * path_string ) )
108+ Some ( path. join ( path_str ) )
107109 }
108110
109111 pub ( crate ) fn parse_file_as_module (
You can’t perform that action at this time.
0 commit comments