File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -166,16 +166,16 @@ impl Attrs {
166
166
}
167
167
168
168
pub fn docs ( & self ) -> Option < Documentation > {
169
- let mut docs = String :: new ( ) ;
170
- self . by_key ( "doc" )
169
+ let docs = self
170
+ . by_key ( "doc" )
171
171
. attrs ( )
172
172
. flat_map ( |attr| match attr. input . as_ref ( ) ? {
173
173
AttrInput :: Literal ( s) => Some ( s) ,
174
174
AttrInput :: TokenTree ( _) => None ,
175
175
} )
176
176
. intersperse ( & SmolStr :: new_inline ( "\n " ) )
177
- // No FromIterator<SmolStr> for String
178
- . for_each ( |s| docs . push_str ( s . as_str ( ) ) ) ;
177
+ . map ( |it| it . as_str ( ) )
178
+ . collect :: < String > ( ) ;
179
179
if docs. is_empty ( ) {
180
180
None
181
181
} else {
@@ -202,14 +202,8 @@ impl Attr {
202
202
fn from_src ( ast : ast:: Attr , hygiene : & Hygiene ) -> Option < Attr > {
203
203
let path = ModPath :: from_src ( ast. path ( ) ?, hygiene) ?;
204
204
let input = if let Some ( lit) = ast. literal ( ) {
205
- // FIXME: escape?
206
205
let value = match lit. kind ( ) {
207
- ast:: LiteralKind :: String ( string) if string. is_raw ( ) => {
208
- let text = string. text ( ) . as_str ( ) ;
209
- let text = & text[ string. text_range_between_quotes ( ) ?
210
- - string. syntax ( ) . text_range ( ) . start ( ) ] ;
211
- text. into ( )
212
- }
206
+ ast:: LiteralKind :: String ( string) => string. value ( ) ?. into ( ) ,
213
207
_ => lit. syntax ( ) . first_token ( ) ?. text ( ) . trim_matches ( '"' ) . into ( ) ,
214
208
} ;
215
209
Some ( AttrInput :: Literal ( value) )
Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ fn module_resolution_explicit_path_mod_rs_with_win_separator() {
372
372
check (
373
373
r#"
374
374
//- /main.rs
375
- #[path = "module\bar\mod.rs"]
375
+ #[path = r "module\bar\mod.rs"]
376
376
mod foo;
377
377
378
378
//- /module/bar/mod.rs
You can’t perform that action at this time.
0 commit comments