I find synonyms(in general) make code both harder to read and to write. When reading, you need to be aware both about the definition and the alias. When writing, you need to actively choose one.
This seems like an uninteresting question, and I generally try to rule-of-thumb all uninteresting and unimportant questions, so that I can think about interesting ones.
Somewhat similarly, for intra-crate imports, I always use use crate::foo::bar, and not use super::bar, not because the former is better (the question is irrelevant) but because it gives me less space to deliberate.
Would that warn when imported as use smt::Error as SmtError? Or any other prefix the user likes really.
I think it's enough to document this stuff somewhere. "The general convention when using common names or free-style functions is to not import them directly but use them through the parent module". Then it's up to the user to decide what fits best.
I'm not understanding that code sample. Is it equivalent to the following?
use image::png::Decoder as PngDecoder;
let _ = PngDecoder::new(...);
In that case the gains don't seem that big, and use image::png already enables the very similar png::Decoder (a bit more noise on use, but shorter to import!).
I think it should. Actually I think it should warn about any direct (not glob ::*) import of Error, doesn't count with or without renaming + any mention of Error if imported by glob import.
The point is - if you want to follow this convention, you probably want to notice when you've mistaken (and that can happen frequently because IDEs are always suggesting using item w/o prefix)
That seems fixable, at least for the common case of Error and Result types, the IDE could detect those names and suggest useing the module and a semi-qualified path.
Let us trust the programmer to decide this for him or herself. Rust is already quite a "nanny" language with default warnings about names not following suggested upper/lowercase patterns. I don't think it needs to also care about how the programmer uses the tool that is use statements.
Not everyone is using an IDE and I don't think "let the IDE handle it" should be a valid argument. Let people use IDEs as an enhancement, but don't build the language around the assumption that they're always available (I edit code I'm different contexts, such as via GitHub quick edits and with my editor).
Yeah, I get that it would be allowed by default β but simply seeing the warning will make me feel that I'm doing something wrong and I'll then have to investigate how to a) fix the worning, or b) silence the warning.
DENY - means it is a compiler error if the lint's requirements are not met, so, until you correct the issue, your program will not compile fully and link.
WARN - means that you'll receive a warning, but your program will still compile and link
ALLOW - means that you won't receive a warning or any error at all (the lints requirements will be ignored).
So, if it is "Allow by Default", that means you'll never see a warning unless you explicitly set it to WARN or DENY in your program.