about summary refs log tree commit diff
path: root/clippy_lints/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-04 13:07:26 +0000
committerbors <bors@rust-lang.org>2022-04-04 13:07:26 +0000
commit190f0deac83174de23ff21f980ab514c90e0e59e (patch)
tree06e50a0aaee1ff8d5d35c4d6fd1b7f3e224b481d /clippy_lints/src/lib.rs
parent1cec8b30fac2c13504de7e7f950bd36c497858b1 (diff)
parent17c8bee95a43cf9c39ec766cdaa8c6219f4126dd (diff)
downloadrust-190f0deac83174de23ff21f980ab514c90e0e59e.tar.gz
rust-190f0deac83174de23ff21f980ab514c90e0e59e.zip
Auto merge of #8450 - Jarcho:unsafe_blocks_8449, r=giraffate
Rework `undocumented_unsafe_blocks`

fixes: #8264
fixes: #8449

One thing came up while working on this. Currently comments on the same line are supported like so:

```rust
/* SAFETY: reason */ unsafe {}
```

Is this worth supporting at all? Anything other than a couple of words doesn't really fit well.

edit: [zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60undocumented_unsafe_blocks.60.20same.20line.20comment)

changelog: Don't lint `undocumented_unsafe_blocks` when the unsafe block comes from a proc-macro.
changelog: Don't lint `undocumented_unsafe_blocks` when the preceding line has a safety comment and the unsafe block is a sub-expression.
Diffstat (limited to 'clippy_lints/src/lib.rs')
-rw-r--r--clippy_lints/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 3138ee9bce5..8dab039f24f 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -1,5 +1,6 @@
 // error-pattern:cargo-clippy
 
+#![feature(array_windows)]
 #![feature(binary_heap_into_iter_sorted)]
 #![feature(box_patterns)]
 #![feature(control_flow_enum)]
@@ -849,7 +850,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
             enable_raw_pointer_heuristic_for_send,
         ))
     });
-    store.register_late_pass(move || Box::new(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks::default()));
+    store.register_late_pass(move || Box::new(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks));
     store.register_late_pass(|| Box::new(match_str_case_mismatch::MatchStrCaseMismatch));
     store.register_late_pass(move || Box::new(format_args::FormatArgs));
     store.register_late_pass(|| Box::new(trailing_empty_array::TrailingEmptyArray));