Skip to content

Commit 860cb8f

Browse files
committed
Auto merge of #7294 - stevenengler:unsafe-ptr-deref-msg, r=Manishearth
Improve message for `not_unsafe_ptr_arg_deref` lint changelog: Improved message for the ['not_unsafe_ptr_arg_deref'] lint Doesn't close any issue, but implements a suggestion from #3045 (comment).
2 parents d1308ae + 58491d3 commit 860cb8f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'a, 'tcx> DerefVisitor<'a, 'tcx> {
116116
self.cx,
117117
NOT_UNSAFE_PTR_ARG_DEREF,
118118
ptr.span,
119-
"this public function dereferences a raw pointer but is not marked `unsafe`",
119+
"this public function might dereference a raw pointer but is not marked `unsafe`",
120120
);
121121
}
122122
}

tests/ui/functions.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,57 +30,57 @@ error: this function has too many arguments (8/7)
3030
LL | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3232

33-
error: this public function dereferences a raw pointer but is not marked `unsafe`
33+
error: this public function might dereference a raw pointer but is not marked `unsafe`
3434
--> $DIR/functions.rs:63:34
3535
|
3636
LL | println!("{}", unsafe { *p });
3737
| ^
3838
|
3939
= note: `-D clippy::not-unsafe-ptr-arg-deref` implied by `-D warnings`
4040

41-
error: this public function dereferences a raw pointer but is not marked `unsafe`
41+
error: this public function might dereference a raw pointer but is not marked `unsafe`
4242
--> $DIR/functions.rs:64:35
4343
|
4444
LL | println!("{:?}", unsafe { p.as_ref() });
4545
| ^
4646

47-
error: this public function dereferences a raw pointer but is not marked `unsafe`
47+
error: this public function might dereference a raw pointer but is not marked `unsafe`
4848
--> $DIR/functions.rs:65:33
4949
|
5050
LL | unsafe { std::ptr::read(p) };
5151
| ^
5252

53-
error: this public function dereferences a raw pointer but is not marked `unsafe`
53+
error: this public function might dereference a raw pointer but is not marked `unsafe`
5454
--> $DIR/functions.rs:76:30
5555
|
5656
LL | println!("{}", unsafe { *p });
5757
| ^
5858

59-
error: this public function dereferences a raw pointer but is not marked `unsafe`
59+
error: this public function might dereference a raw pointer but is not marked `unsafe`
6060
--> $DIR/functions.rs:77:31
6161
|
6262
LL | println!("{:?}", unsafe { p.as_ref() });
6363
| ^
6464

65-
error: this public function dereferences a raw pointer but is not marked `unsafe`
65+
error: this public function might dereference a raw pointer but is not marked `unsafe`
6666
--> $DIR/functions.rs:78:29
6767
|
6868
LL | unsafe { std::ptr::read(p) };
6969
| ^
7070

71-
error: this public function dereferences a raw pointer but is not marked `unsafe`
71+
error: this public function might dereference a raw pointer but is not marked `unsafe`
7272
--> $DIR/functions.rs:87:34
7373
|
7474
LL | println!("{}", unsafe { *p });
7575
| ^
7676

77-
error: this public function dereferences a raw pointer but is not marked `unsafe`
77+
error: this public function might dereference a raw pointer but is not marked `unsafe`
7878
--> $DIR/functions.rs:88:35
7979
|
8080
LL | println!("{:?}", unsafe { p.as_ref() });
8181
| ^
8282

83-
error: this public function dereferences a raw pointer but is not marked `unsafe`
83+
error: this public function might dereference a raw pointer but is not marked `unsafe`
8484
--> $DIR/functions.rs:89:33
8585
|
8686
LL | unsafe { std::ptr::read(p) };

0 commit comments

Comments
 (0)