mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
4886937212
Ignore fix for `from_over_into` if the target type contains a `Self` reference Fixes https://github.com/rust-lang/rust-clippy/issues/10838. This is my first time contributing here, and the fix is kind of ugly. I've worked a bit with `quote` and was trying to figure out a way to replace the type in a better way than just a raw string-replace but couldn't quite figure out how to. The only thing really required to fix this, is to replace all `Self` references with the type stated in the `from` variable, this isn't entirely simple to do with raw strings without creating a mess though. We need to find and replace all `Self`'s in a variable with `from` but there could be an arbitrary amount, in a lot of different positions. As well as some type that contains the name self, like `SelfVarSelf` which shouldn't be replaced. The strategy is essentially, if `"Self"` is surrounded on both sides by something that isn't alphanumeric, then we're golden, then trying to make that reasonably efficient. I would not be offended if the solution is too messy to accept! changelog: [from_over_into]: Replace Self with the indicated variable in suggestion and fix. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |