-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lint to identify core symbols consumed through std #7724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On that note, I'd be interested to hear if there is a good way to programmatically determine whether something is available from |
Very reasonable as a restriction lint. Name idea: |
Maybe if there were a way to programmatically get what crate a symbol belongs to? something like |
Many thanks for getting these lints implemented, @i509VCB! |
What it does
Personally, I think it would be helpful to have a lint that tells me that a symbol that I am using is available from the
core
crate, but I am importing it throughstd
.Categories (optional)
clippy::pedantic
What is the advantage of the recommended code over the original code
In embedded development or whenever there may be a reason to have
no_std
compatibility in one form or another at some point, it is helpful to get an understanding of what is consumed fromstd
, but really coming fromcore
and could be used directly from there (and would not need to be feature gated, replaced, or whatever). Hence, having a lint that could highlight the use of re-exportedcore
symbols throughstd
would be useful, e.g., whenno_std
support is desirable at some point in the future, but perhaps not implemented right now.Drawbacks
Not everyone may feel strongly about identifying
core
functionality as such and, in fact, in a good amount of cases there may not be any benefit to side-steppingstd
partly. But then it should be an optional feature, similar in nature toprint_stdout
, for example.Example
Could be written as:
The text was updated successfully, but these errors were encountered: