Skip to content

Commit

Permalink
Update on_unimplemented for format string changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Apr 3, 2024
1 parent 5e29b01 commit 52874b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/attributes/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,17 @@ If any of the other options appears several times the first occurrence of the re
Any other occurrence generates an lint warning.
For any other non-existing option a lint-warning is generated.
All three options accept a string as an argument.
The text in the string may contain the following format parameters which provide substitutions in the generated message:
All three options accept a string as an argument, interpreted using the same formatting as a [`std::fmt`] string.
Format parameters with the given named parameter will be replaced with the following text:
* `{Self}` — The name of the type implementing the trait.
* `{` *GenericParameterName* `}` — The name of the generic argument's type for the given generic parameter.
Any other format parameter will generate a warning, but will otherwise be included in the string as-is.
Invalid format strings may generate a warning, but are otherwise allowed, but may not display as intended.
Format specifiers may generate a warning, but are otherwise ignored.
In this example:
```rust,compile_fail,E0277
Expand Down Expand Up @@ -367,6 +370,7 @@ error[E0277]: My Message for `ImportantTrait<i32>` implemented for `String`
= note: Note 2
```

[`std::fmt`]: ../../std/fmt/index.html
[Clippy]: https://github.com/rust-lang/rust-clippy
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
[_MetaListPaths_]: ../attributes.md#meta-item-attribute-syntax
Expand Down

0 comments on commit 52874b8

Please sign in to comment.