File tree 1 file changed +8
-12
lines changed
compiler/rustc_ast_pretty/src/pprust
1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -67,19 +67,15 @@ impl<'a> Comments<'a> {
67
67
span : rustc_span:: Span ,
68
68
next_pos : Option < BytePos > ,
69
69
) -> Option < Comment > {
70
- if let Some ( cmnt) = self . next ( ) {
71
- if cmnt. style != CommentStyle :: Trailing {
72
- return None ;
73
- }
74
- let span_line = self . sm . lookup_char_pos ( span. hi ( ) ) ;
75
- let comment_line = self . sm . lookup_char_pos ( cmnt. pos ) ;
76
- let next = next_pos. unwrap_or_else ( || cmnt. pos + BytePos ( 1 ) ) ;
77
- if span. hi ( ) < cmnt. pos && cmnt. pos < next && span_line. line == comment_line. line {
78
- return Some ( cmnt) ;
79
- }
80
- }
70
+ self . next ( ) . filter ( |cmnt| {
71
+ cmnt. style == CommentStyle :: Trailing && {
72
+ let span_line = self . sm . lookup_char_pos ( span. hi ( ) ) ;
73
+ let comment_line = self . sm . lookup_char_pos ( cmnt. pos ) ;
74
+ let next = next_pos. unwrap_or_else ( || cmnt. pos + BytePos ( 1 ) ) ;
81
75
82
- None
76
+ span. hi ( ) < cmnt. pos && cmnt. pos < next && span_line. line == comment_line. line
77
+ }
78
+ } )
83
79
}
84
80
}
85
81
You can’t perform that action at this time.
0 commit comments