Update on_unimplemented for format string changes.

Updated in https://github.com/rust-lang/rust/pull/122402
This commit is contained in:
Eric Huss 2024-04-03 14:29:34 -07:00
parent 5e29b0135e
commit 52874b8312
1 changed files with 6 additions and 2 deletions

View File

@ -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
@ -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