www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Unused imports

reply Michael <michaelhusmann gmail.com> writes:
Is there a way to detect unused imports?

It happened to me that I used imports which I did not need in the 
end. So, I'd like to remove them easily.
Jan 30 2020
parent Francesco Mecca <me francescomecca.eu> writes:
On Thursday, 30 January 2020 at 16:23:54 UTC, Michael wrote:
 Is there a way to detect unused imports?

 It happened to me that I used imports which I did not need in 
 the end. So, I'd like to remove them easily.
https://issues.dlang.org/show_bug.cgi?id=20442 TL;DR This has come up in the past and the typical answer was: "This should be implemented as a third party tool using dmd as a library". It is a problem that there are no currently available tools to do that (maybe visual-d greys out unused imports) but I do agree that it should be provided as a third party. Such a functionality could end up in: https://github.com/dlang-community/D-Scanner and it is also a good first time project for a beginner in the D ecosystem.
Jan 30 2020