Skip to content

Commit 78589ff

Browse files
committed
Auto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995
Move `unnecessary_unsafety_doc` to `pedantic` This lint was added in #9822. I like the idea, but also agree with #9986 as well. I think it should at least not be warn-by-default. This is one of these cases, where I'd like a group between pedantic and restriction. But I believe that users using `#![warn(clippy::pedantic)]` will know how to enable the lint if they disagree with it. --- Since the lint is new: changelog: none r? `@flip1995` since I'd suggest back porting this, the original PR was merged 16 days ago. Closes: #9986 (While it doesn't address everything, I believe that this is the best compromise)
2 parents 3cf2c17 + cc43c3d commit 78589ff

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ declare_clippy_lint! {
253253
/// ```
254254
#[clippy::version = "1.66.0"]
255255
pub UNNECESSARY_SAFETY_DOC,
256-
style,
256+
restriction,
257257
"`pub fn` or `pub trait` with `# Safety` docs"
258258
}
259259

tests/ui/doc_unnecessary_unsafe.rs renamed to tests/ui/unnecessary_unsafety_doc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// aux-build:doc_unsafe_macros.rs
22

33
#![allow(clippy::let_unit_value)]
4+
#![warn(clippy::unnecessary_safety_doc)]
45

56
#[macro_use]
67
extern crate doc_unsafe_macros;

tests/ui/doc_unnecessary_unsafe.stderr renamed to tests/ui/unnecessary_unsafety_doc.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
error: safe function's docs have unnecessary `# Safety` section
2-
--> $DIR/doc_unnecessary_unsafe.rs:18:1
2+
--> $DIR/unnecessary_unsafety_doc.rs:19:1
33
|
44
LL | pub fn apocalypse(universe: &mut ()) {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::unnecessary-safety-doc` implied by `-D warnings`
88

99
error: safe function's docs have unnecessary `# Safety` section
10-
--> $DIR/doc_unnecessary_unsafe.rs:44:5
10+
--> $DIR/unnecessary_unsafety_doc.rs:45:5
1111
|
1212
LL | pub fn republished() {
1313
| ^^^^^^^^^^^^^^^^^^^^
1414

1515
error: safe function's docs have unnecessary `# Safety` section
16-
--> $DIR/doc_unnecessary_unsafe.rs:57:5
16+
--> $DIR/unnecessary_unsafety_doc.rs:58:5
1717
|
1818
LL | fn documented(self);
1919
| ^^^^^^^^^^^^^^^^^^^^
2020

2121
error: docs for safe trait have unnecessary `# Safety` section
22-
--> $DIR/doc_unnecessary_unsafe.rs:67:1
22+
--> $DIR/unnecessary_unsafety_doc.rs:68:1
2323
|
2424
LL | pub trait DocumentedSafeTrait {
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2626

2727
error: safe function's docs have unnecessary `# Safety` section
28-
--> $DIR/doc_unnecessary_unsafe.rs:95:5
28+
--> $DIR/unnecessary_unsafety_doc.rs:96:5
2929
|
3030
LL | pub fn documented() -> Self {
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3232

3333
error: safe function's docs have unnecessary `# Safety` section
34-
--> $DIR/doc_unnecessary_unsafe.rs:122:9
34+
--> $DIR/unnecessary_unsafety_doc.rs:123:9
3535
|
3636
LL | pub fn drive() {
3737
| ^^^^^^^^^^^^^^
@@ -42,7 +42,7 @@ LL | very_safe!();
4242
= note: this error originates in the macro `very_safe` (in Nightly builds, run with -Z macro-backtrace for more info)
4343

4444
error: docs for safe trait have unnecessary `# Safety` section
45-
--> $DIR/doc_unnecessary_unsafe.rs:146:1
45+
--> $DIR/unnecessary_unsafety_doc.rs:147:1
4646
|
4747
LL | pub trait DocumentedSafeTraitWithImplementationHeader {
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)