@@ -463,10 +463,13 @@ pub fn check(path: &Path, bad: &mut bool) {
463
463
}
464
464
}
465
465
// for now we just check libcore
466
- if trimmed. contains ( "unsafe {" ) && !trimmed. starts_with ( "//" ) && !last_safety_comment {
467
- if file. components ( ) . any ( |c| c. as_os_str ( ) == "core" ) && !is_test {
468
- suppressible_tidy_err ! ( err, skip_undocumented_unsafe, "undocumented unsafe" ) ;
469
- }
466
+ if trimmed. contains ( "unsafe {" )
467
+ && !trimmed. starts_with ( "//" )
468
+ && !last_safety_comment
469
+ && file. components ( ) . any ( |c| c. as_os_str ( ) == "core" )
470
+ && !is_test
471
+ {
472
+ suppressible_tidy_err ! ( err, skip_undocumented_unsafe, "undocumented unsafe" ) ;
470
473
}
471
474
if trimmed. contains ( "// SAFETY:" ) {
472
475
last_safety_comment = true ;
@@ -487,10 +490,10 @@ pub fn check(path: &Path, bad: &mut bool) {
487
490
"copyright notices attributed to the Rust Project Developers are deprecated"
488
491
) ;
489
492
}
490
- if !file. components ( ) . any ( |c| c. as_os_str ( ) == "rustc_baked_icu_data" ) {
491
- if is_unexplained_ignore ( & extension, line) {
492
- err ( UNEXPLAINED_IGNORE_DOCTEST_INFO ) ;
493
- }
493
+ if !file. components ( ) . any ( |c| c. as_os_str ( ) == "rustc_baked_icu_data" )
494
+ && is_unexplained_ignore ( & extension, line)
495
+ {
496
+ err ( UNEXPLAINED_IGNORE_DOCTEST_INFO ) ;
494
497
}
495
498
496
499
if filename. ends_with ( ".cpp" ) && line. contains ( "llvm_unreachable" ) {
@@ -525,26 +528,24 @@ pub fn check(path: &Path, bad: &mut bool) {
525
528
backtick_count += comment_text. chars ( ) . filter ( |ch| * ch == '`' ) . count ( ) ;
526
529
}
527
530
comment_block = Some ( ( start_line, backtick_count) ) ;
528
- } else {
529
- 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
- ) ;
547
- }
531
+ } else if let Some ( ( start_line, backtick_count) ) = comment_block. take ( ) {
532
+ if backtick_count % 2 == 1 {
533
+ let mut err = |msg : & str | {
534
+ tidy_error ! ( bad, "{}:{start_line}: {msg}" , file. display( ) ) ;
535
+ } ;
536
+ let block_len = ( i + 1 ) - start_line;
537
+ if block_len == 1 {
538
+ suppressible_tidy_err ! (
539
+ err,
540
+ skip_odd_backticks,
541
+ "comment with odd number of backticks"
542
+ ) ;
543
+ } else {
544
+ suppressible_tidy_err ! (
545
+ err,
546
+ skip_odd_backticks,
547
+ "{block_len}-line comment block with odd number of backticks"
548
+ ) ;
548
549
}
549
550
}
550
551
}
0 commit comments