Skip to content

Fix documentation that disagrees with code #369

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

Merged
merged 1 commit into from
Oct 8, 2015

Conversation

fhartwig
Copy link
Contributor

@fhartwig fhartwig commented Oct 7, 2015

Minor fix: the comment currently disagrees with the lint declaration.

Out of curiosity: why is this lint allow by default? It seems to me like this should be uncontroversial.

@Manishearth
Copy link
Member

I actually can't remember why it's Allow. @llogiq ?

@llogiq
Copy link
Contributor

llogiq commented Oct 8, 2015

I remember that we had a major false positive with &mut Vec, where any of the functions &mut [_] doesn't have is used.

@Manishearth
Copy link
Member

Oh, right.

Manishearth added a commit that referenced this pull request Oct 8, 2015
Fix documentation that disagrees with code
@Manishearth Manishearth merged commit 6f84e35 into rust-lang:master Oct 8, 2015
@fhartwig
Copy link
Contributor Author

fhartwig commented Oct 8, 2015

My reading of the lint is that it only checks for shared references (and the tests support that reading), so I don't understand how this would cause false positives.

@Manishearth
Copy link
Member

&mut Vec<T> has more capabilities than &mut [T], so there are cases when you may want to allow that.

Making the test ignore &mut Vec would be an acceptable change (and would make it okay to be Allow)

@fhartwig
Copy link
Contributor Author

fhartwig commented Oct 8, 2015

I understand that part, but the lint only warns about &Vec, not about &mut Vec, unless I'm missing something. The tests even say:

fn do_vec_mut(x: &mut Vec<i64>) { // no error here
    //Nothing here
}

@Manishearth
Copy link
Member

Oh, hm, we do check for immutability.

I'm willing to accept a PR that makes this warn, then 😄

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.

3 participants