Skip to content
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

[WIP] Make Cargo warn about unrecognized sections and possibly give suggestions #5515

Closed
wants to merge 1 commit into from

Conversation

iancormac84
Copy link

Closes #5264.

…key. Will look into making it cover as many cases of possible misspelling of recognized keys as possible.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@iancormac84
Copy link
Author

I intend to make this code more flexible so that it will give potentially useful suggestions about current or future recognized keys in Cargo.toml files. I'm thinking that to do so, I need to have a list of keys that are recognized by cargo. The best option I can think of is to have a static list of the keys that are recognized, which incurs a maintenance cost. What do you guys think?

@matklad
Copy link
Member

matklad commented May 11, 2018

@iancormac84 but dost it warn that path is unused in the first place? From the description of #5264 I've got the idea that patch misspellings don't trigger this particular logic at all...

Could you add a test from #5264 somewhere near this place:

fn unused_keys() {

That way, it should be easier to see what is going on here. Perhaps we do warn about misspelled patch already?

As for making this code general, I suggest that, at first, we just produce the usual unused key warning here, without elaboration, because that'll get us 80% of the benefits. a lev-distance solution is excellent, but we need to add it in such way that it handles all the keys.

@iancormac84
Copy link
Author

iancormac84 commented May 12, 2018

@matklad It indeed does mention unused manifest key 'path', for example, but no mention of the remaining ."https://github.com/foo/bar". So I'm guessing that's what I need to work towards it outputting something like

warning: unused manifest key: path."https://github.com/foo/bar"
?

@alexcrichton
Copy link
Member

@iancormac84 did you have any luck extending this to handle all the keys?

@alexcrichton
Copy link
Member

Ok I'm gonna close this due to inactivity, but feel fre of course to resubmit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants