Warn on unused imports?

Laurent Tréguier laurent.treguier.sink at gmail.com
Wed Sep 26 10:46:23 UTC 2018


On Wednesday, 26 September 2018 at 09:25:11 UTC, Jonathan M Davis 
wrote:
> IMHO, the way that dmd currently handles deprecations works 
> quite well overall. It simply prints a message. It's not a 
> warning, and it's not an error. It's just a message. You can 
> use a compiler flag to make the message go away or to turn it 
> into an error (though in general, I'd advise against it, since 
> then your code breaks as soon as something gets deprecated), 
> but by default, they're just messages.

 From dmd's help:
```
   -d                silently allow deprecated features
   -dw               show use of deprecated features as warnings 
(default)
   -de               show use of deprecated features as errors 
(halt compilation)
```
Deprecations are shown as warnings and not simple messages it 
seems. But this is probably just a matter of wording here, so not 
really relevant I think.

Beyond that I agree with the idea of letting linters and the like 
point out bad practices or suspicious things such as unused 
imports; as a compiler's role is to compile, while a linter's 
role is to lint.


More information about the Digitalmars-d mailing list