File tree 1 file changed +21
-19
lines changed
1 file changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -150,15 +150,16 @@ impl Program {
150
150
let comments: Vec < String > = f. attrs
151
151
. iter ( )
152
152
. filter_map ( |a| {
153
- if a. style == AttrStyle :: Outer {
154
- Some (
155
- a. tts . clone ( ) . into_iter ( ) . filter_map ( |t| match t {
156
- TokenTree :: Literal ( lit) => Some ( format ! ( "{}" , lit) ) ,
157
- _ => None ,
158
- } )
159
- )
160
- } else {
161
- None
153
+ match a. style {
154
+ AttrStyle :: Outer => {
155
+ Some (
156
+ a. tts . clone ( ) . into_iter ( ) . filter_map ( |t| match t {
157
+ TokenTree :: Literal ( lit) => Some ( format ! ( "{}" , lit) ) ,
158
+ _ => None ,
159
+ } )
160
+ )
161
+ } ,
162
+ _ => None ,
162
163
}
163
164
} )
164
165
. fold ( vec ! [ ] , |mut acc, a| { acc. extend ( a) ; acc} ) ;
@@ -1103,16 +1104,17 @@ fn extract_doc_comments(attrs: &Vec<syn::Attribute>) -> Vec<String> {
1103
1104
. iter ( )
1104
1105
. filter_map ( |a| {
1105
1106
//We only care about outer comments for now
1106
- if a. style == AttrStyle :: Outer {
1107
- //We only care about literal values
1108
- Some (
1109
- a. tts . clone ( ) . into_iter ( ) . filter_map ( |t| match t {
1110
- TokenTree :: Literal ( lit) => Some ( lit. to_string ( ) ) ,
1111
- _ => None ,
1112
- } )
1113
- )
1114
- } else {
1115
- None
1107
+ match a. style {
1108
+ AttrStyle :: Outer => {
1109
+ //We only care about literal values
1110
+ Some (
1111
+ a. tts . clone ( ) . into_iter ( ) . filter_map ( |t| match t {
1112
+ TokenTree :: Literal ( lit) => Some ( lit. to_string ( ) ) ,
1113
+ _ => None ,
1114
+ } )
1115
+ )
1116
+ } ,
1117
+ _ => None
1116
1118
}
1117
1119
} )
1118
1120
//Fold up the [[String]] iter we created into Vec<String>
You can’t perform that action at this time.
0 commit comments