Skip to content

Commit d646270

Browse files
add reason example
Co-authored-by: Eric Huss <[email protected]>
1 parent e916727 commit d646270

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

posts/2024-09-05-Rust-1.81.0.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ if code runs in an environment without floating point support, you could use
6868
Clippy to lint on such usage with `#![deny(clippy::float_arithmetic)]`.
6969
However, if a new developer to the project sees this lint fire, they need to
7070
look for (hopefully) a comment on the deny explaining why it was added. With
71-
Rust 1.81, they can be informed directly in the compiler message:
71+
Rust 1.81, they can be informed directly in the compiler message by adding a `reason` to the lint attribute:
72+
73+
```rust
74+
#![deny(clippy::float_arithmetic, reason = "no hardware float support")]
75+
```
76+
77+
When this lint is triggered, the compiler will include the reason in its output:
7278

7379
```text
7480
error: floating-point arithmetic detected

0 commit comments

Comments
 (0)