Skip to content

Commit 7497cdd

Browse files
antonio-hickeyintel-lab-lkp
authored andcommitted
rust: clippy: disable addr_of! and addr_of_mut macros
With the `raw_ref_op` feature enabled we no longer want to allow use of `addr_of!` and `addr_of_mut!` macros. We instead want to use `&raw` and `&raw mut` to get raw pointers to a place. Suggested-by: Benno Lossin <[email protected]> Link: Rust-for-Linux#1148 Signed-off-by: Antonio Hickey <[email protected]>
1 parent b896e78 commit 7497cdd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.clippy.toml

+4
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ disallowed-macros = [
88
# The `clippy::dbg_macro` lint only works with `std::dbg!`, thus we simulate
99
# it here, see: https://github.com/rust-lang/rust-clippy/issues/11303.
1010
{ path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool" },
11+
# With `raw_ref_op` feature enabled we no longer want to allow use of `addr_of!`
12+
# and `addr_of_mut!` macros, but instead use `&raw` or `&raw mut`.
13+
{ path = "core::ptr::addr_of_mut", reason = "use `&raw mut` instead `addr_of_mut!`" },
14+
{ path = "core::ptr::addr_of", reason = "use `&raw` instead `addr_of!`" },
1115
]

0 commit comments

Comments
 (0)