-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Disallow stylistic lint #11457
Disallow stylistic lint #11457
Conversation
Adding more of these would be a good newbie project #3070. Just coming up with new ideas for them and putting them in the issue would be good. |
Does this bootstrap without some library changes? (i.e. for now, just adding |
The next round of fixes to do occurs in macros expansions, such as:
which is not recognized as uppercase. I'm not sure what the smart way to fix these is, however. EDIT: EDIT2: The lint check seems to occur after macro expansion, which means the args of the macro have to be uppercase. This means changing the macro:
Not sure I want to meddle with this... |
This looks pretty sweet, and I like that it already caught a lot of stylistic violations. I don't quite understand what's blocking. Is one of our macros generating incorrect identifiers? |
I'm not very familiar with macros expansion in rust, so I can only guess. Some macros seem to define static variables with things like $name, where $name is provided by the macro use. In some macro, the identifier provided is not UPPER_CASE, so after macro expansion it fails. The macro that stops make check now is one that (seems to) define the language keywords. I have not put enough time in it to really realize if it's safe to change its (only, as far as I and grep can tell) use. |
It's probably ok to just put (Also, this needs a rebase.) |
So, I put the #[allow(non_uppercase_statics)] on top of the complaining files, but somehow it still doesn't pass a make check ? I'm unsure where to go from there |
I think the
works, while
only allows non-camel-case-types for the |
Thanks, it now passes that stage, opening up another lot of fixes to be made. |
@@ -53,10 +53,10 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 { | |||
return (origamt - amt) as i64; | |||
} | |||
|
|||
pub type fd_t = libc::c_int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an exception for this? It should really be fd_t
Nice work, and thanks! Could you also rebase the commits into two stages? The first is enabling the lints and the second would just be dealing with the fallout. |
Just to be sure, (not so good at git yet), you want me to move HEAD to the commit enabling the lints, do a rebase there, and then move back to the current stage and rebase too ? |
I normally rebase by using |
Is this what you wanted ? |
I think this ended up picking up a lot of extra commits from all over the place. If you take a look at github's commits tab you can tell if it's gotten to the right point. |
Looks like it worked but the branch history is bloated. I would start from a clean branch and cherry-pick the two squashed commits, |
Agreed. Is there any better way to do that than closing this PR, creating a new branch, rebase -i on this one removing every commit except these 2, and the PR-ing again ? |
Here is what I would do: |
Note that you can probably achieve that with by resetting the branch but starting from a clean one is always guaranteed to succeed. (The other way around would be |
The branch should now be clean. After swapping, the remote branch was ahead from the (swapped and cleaned) local one, and pulling would have included all the removed useless commits (right ?) so I deleted the remote, and pushed again. Are there better ways ? |
@TisButMe Sorry I forgot to precise, you have to use |
@adridu59 Thanks ! I'll do it the right way next time then :) |
There are still 7 "junk" commits, from what I can see. |
There we go. |
This needs a rebase. |
Closing due to inactivity, but feel free to open with a rebase! |
Hope this gets picked up again! |
Sorry for the lack of activity, I am a bit busy at the moment. I'll try to 2014-02-06 Brian Anderson notifications@github.com:
|
I tried to go for this in the meantime and by just setting What do you think the correct approach to this should be? I'd like to continue working on this. Should I send a work in progress pull request and temporarily put |
@mrshu Were they legitimate violations or are there 330 places where we really need to violate the style guide? |
@brson There are things like So to answer your question, I do not really know. |
I guess then I'd say turn it on and put |
@brson thanks for clarification. Here is what I got btw: http://paste.pm/e1a.js |
To anyone wanting to restart work on this: there are already files that 2014-02-14 0:13 GMT+01:00 Marek Šuppa notifications@github.com:
|
fix: incorrect suggestions generated by `manual_retain` lint fixes rust-lang#10393, fixes rust-lang#11457, fixes rust-lang#12081 rust-lang#10393: In the current implementation of `manual_retain`, if the argument to the closure is matched using tuple, they are all treated as the result of a call to `map.into_iter().filter(<f>)`. However, such tuple pattern matching can also occur in many different containers that stores tuples internally. The correct approach is to apply different lint policies depending on whether the receiver of `into_iter` is a map or not. rust-lang#11457 and rust-lang#12081: In the current implementation of `manual_retain`, if the argument to the closure is `Binding`, the closure will be used directly in the `retain` method, which will result in incorrect suggestion because the first argument to the `retain` closure may be of a different type. In addition, if the argument to the closure is `Ref + Binding`, the lint will simply remove the `Ref` part and use the `Binding` part as the argument to the new closure, which will lead to bad suggestion for the same reason. The correct approach is to detect each of these cases and apply lint suggestions conservatively. changelog: [`manual_retain`] refactor and add check for various patterns
See #11432