File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -337,12 +337,12 @@ impl<'tcx> FormatArgsExpr<'_, 'tcx> {
337337 fn check_trailing_comma ( & self ) {
338338 let span = self . macro_call . span ;
339339 if let Some ( src) = span. get_source_text ( self . cx )
340- && !src. contains ( '\n' )
341340 && let Some ( src) = src. strip_suffix ( [ ')' , ']' , '}' ] )
342- && let src = src. trim_end_matches ( |c : char | c. is_whitespace ( ) )
341+ && let src = src. trim_end_matches ( |c : char | c. is_whitespace ( ) && c != '\n' )
343342 && let Some ( src) = src. strip_suffix ( ',' )
343+ && let src = src. trim_end_matches ( |c : char | c. is_whitespace ( ) && c != '\n' )
344+ && !src. ends_with ( '\n' )
344345 {
345- let src = src. trim_end_matches ( |c : char | c. is_whitespace ( ) ) ;
346346 span_lint_and_sugg (
347347 self . cx ,
348348 UNNECESSARY_TRAILING_COMMA ,
You can’t perform that action at this time.
0 commit comments