Closed
Description
For example, consider this snippet (playground):
pub type Result<T> = std::result::Result<T, Errror>;
/// Error type for Kvs
#[derive(Debug)]
pub enum Error {
DuplicateKey,
KeyNotFound,
UnexpectedCommandType,
}
Currently rustc errors:
error[E0412]: cannot find type `Errror` in this scope
--> src/lib.rs:1:45
|
1 | pub type Result<T> = std::result::Result<T, Errror>;
| ^^^^^^
...
5 | / pub enum Error {
6 | | DuplicateKey,
7 | | KeyNotFound,
8 | | UnexpectedCommandType,
9 | | }
| |_- similarly named enum `Error` defined here
|
help: an enum with a similar name exists
|
1 | pub type Result<T> = std::result::Result<T, Error>;
| ^^^^^
help: you might be missing a type parameter
|
1 | pub type Result<T, Errror> = std::result::Result<T, Errror>;
| ^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0412`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
I would like it to highlight only the type name:
error[E0412]: cannot find type `Errror` in this scope
--> src/lib.rs:1:45
|
1 | pub type Result<T> = std::result::Result<T, Errror>;
| ^^^^^^
...
5 | pub enum Error {
| ^^^^^^^^^^ - similarly named enum `Error` defined here
|
help: an enum with a similar name exists
|
1 | pub type Result<T> = std::result::Result<T, Error>;
| ^^^^^
help: you might be missing a type parameter
|
1 | pub type Result<T, Errror> = std::result::Result<T, Errror>;
| ^^^^^^^^
Related issue on clippy: rust-lang/rust-clippy#5284