@@ -461,10 +461,13 @@ pub fn check(path: &Path, bad: &mut bool) {
461461 }
462462 }
463463 // for now we just check libcore
464- if trimmed. contains ( "unsafe {" ) && !trimmed. starts_with ( "//" ) && !last_safety_comment {
465- if file. components ( ) . any ( |c| c. as_os_str ( ) == "core" ) && !is_test {
466- suppressible_tidy_err ! ( err, skip_undocumented_unsafe, "undocumented unsafe" ) ;
467- }
464+ if trimmed. contains ( "unsafe {" )
465+ && !trimmed. starts_with ( "//" )
466+ && !last_safety_comment
467+ && file. components ( ) . any ( |c| c. as_os_str ( ) == "core" )
468+ && !is_test
469+ {
470+ suppressible_tidy_err ! ( err, skip_undocumented_unsafe, "undocumented unsafe" ) ;
468471 }
469472 if trimmed. contains ( "// SAFETY:" ) {
470473 last_safety_comment = true ;
@@ -485,10 +488,10 @@ pub fn check(path: &Path, bad: &mut bool) {
485488 "copyright notices attributed to the Rust Project Developers are deprecated"
486489 ) ;
487490 }
488- if !file. components ( ) . any ( |c| c. as_os_str ( ) == "rustc_baked_icu_data" ) {
489- if is_unexplained_ignore ( & extension, line) {
490- err ( UNEXPLAINED_IGNORE_DOCTEST_INFO ) ;
491- }
491+ if !file. components ( ) . any ( |c| c. as_os_str ( ) == "rustc_baked_icu_data" )
492+ && is_unexplained_ignore ( & extension, line)
493+ {
494+ err ( UNEXPLAINED_IGNORE_DOCTEST_INFO ) ;
492495 }
493496
494497 if filename. ends_with ( ".cpp" ) && line. contains ( "llvm_unreachable" ) {
@@ -523,26 +526,24 @@ pub fn check(path: &Path, bad: &mut bool) {
523526 backtick_count += comment_text. chars ( ) . filter ( |ch| * ch == '`' ) . count ( ) ;
524527 }
525528 comment_block = Some ( ( start_line, backtick_count) ) ;
526- } else {
527- if let Some ( ( start_line, backtick_count) ) = comment_block. take ( ) {
528- if backtick_count % 2 == 1 {
529- let mut err = |msg : & str | {
530- tidy_error ! ( bad, "{}:{start_line}: {msg}" , file. display( ) ) ;
531- } ;
532- let block_len = ( i + 1 ) - start_line;
533- if block_len == 1 {
534- suppressible_tidy_err ! (
535- err,
536- skip_odd_backticks,
537- "comment with odd number of backticks"
538- ) ;
539- } else {
540- suppressible_tidy_err ! (
541- err,
542- skip_odd_backticks,
543- "{block_len}-line comment block with odd number of backticks"
544- ) ;
545- }
529+ } else if let Some ( ( start_line, backtick_count) ) = comment_block. take ( ) {
530+ if backtick_count % 2 == 1 {
531+ let mut err = |msg : & str | {
532+ tidy_error ! ( bad, "{}:{start_line}: {msg}" , file. display( ) ) ;
533+ } ;
534+ let block_len = ( i + 1 ) - start_line;
535+ if block_len == 1 {
536+ suppressible_tidy_err ! (
537+ err,
538+ skip_odd_backticks,
539+ "comment with odd number of backticks"
540+ ) ;
541+ } else {
542+ suppressible_tidy_err ! (
543+ err,
544+ skip_odd_backticks,
545+ "{block_len}-line comment block with odd number of backticks"
546+ ) ;
546547 }
547548 }
548549 }
0 commit comments