mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-01 00:49:30 +00:00
b162b11abc
The to_string_in_display lint is renamed to recursive_format_impl A check is added for the use of self formatted with Display or Debug inside any format string in the same impl The to_string_in_display check is kept as is - like in the format_in_format_args lint For now only Display and Debug are checked This could also be extended to other Format traits (Binary, etc.)
91 lines
3.6 KiB
Text
91 lines
3.6 KiB
Text
error: using `self.to_string` in `fmt::Display` implementation will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:29:25
|
|
|
|
|
LL | write!(f, "{}", self.to_string())
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::recursive-format-impl` implied by `-D warnings`
|
|
|
|
error: unnecessary use of `to_string`
|
|
--> $DIR/recursive_format_impl.rs:61:50
|
|
|
|
|
LL | Self::E(string) => write!(f, "E {}", string.to_string()),
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
|
|
= note: this error originates in the macro `$crate::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:73:9
|
|
|
|
|
LL | write!(f, "{}", self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:82:9
|
|
|
|
|
LL | write!(f, "{}", &self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Debug` in `impl Debug` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:88:9
|
|
|
|
|
LL | write!(f, "{:?}", &self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:97:9
|
|
|
|
|
LL | write!(f, "{}", &&&self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:171:9
|
|
|
|
|
LL | write!(f, "{}", &*self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Debug` in `impl Debug` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:177:9
|
|
|
|
|
LL | write!(f, "{:?}", &*self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:193:9
|
|
|
|
|
LL | write!(f, "{}", *self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:209:9
|
|
|
|
|
LL | write!(f, "{}", **&&*self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: using `self` as `Display` in `impl Display` will cause infinite recursion
|
|
--> $DIR/recursive_format_impl.rs:225:9
|
|
|
|
|
LL | write!(f, "{}", &&**&&*self)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: aborting due to 11 previous errors
|
|
|