File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
compiler/rustc_ast_pretty/src/pprust Expand file tree Collapse file tree 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> {
6767 span : rustc_span:: Span ,
6868 next_pos : Option < BytePos > ,
6969 ) -> 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 ) ) ;
8175
82- None
76+ span. hi ( ) < cmnt. pos && cmnt. pos < next && span_line. line == comment_line. line
77+ }
78+ } )
8379 }
8480}
8581
You can’t perform that action at this time.
0 commit comments