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

Use cargo clippy instead of the clippy plugin #176 #184

Merged
merged 4 commits into from
Jun 22, 2018
Merged

Use cargo clippy instead of the clippy plugin #176 #184

merged 4 commits into from
Jun 22, 2018

Conversation

niedhui
Copy link
Contributor

@niedhui niedhui commented Jun 20, 2018

Hi
first sorry for my messy commit message... I did not realized even I use force push to make the commit clean, but leaved the useless history in the issue page.

Currently the clippy result is same as using clippy plugin, except that even there is some clippy issues , the returned status is still 0, maybe related to rust-lang/rust-clippy#1209, so the CI will mark it as success.

Cargo.toml Outdated
@@ -15,7 +15,7 @@ travis-ci = { repository = "pingcap/rust-prometheus" }

[features]
default = []
dev = ["clippy"]
dev = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this feature now. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. is it safe to also remove these two lines on the Makefile? I had no idea since I had not use any Makefile yet😂
https://github.com/pingcap/rust-prometheus/blob/master/Makefile#L11

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the dev feature and make make dev to be format + test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/lib.rs Outdated
#![cfg_attr(not(feature = "dev"), allow(unknown_lints))]
#![cfg_attr(feature = "dev", allow(needless_pass_by_value))]
#![cfg_attr(feature = "dev", allow(new_without_default_derive))]
#![allow(unknown_lints)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you combine these together?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we allow unknown_lints when feature is not dev. I guess for now this allow should be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, by using

#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value, new_without_default_derive))]

cargo test --features="$FEATURES $LINT";
# Lint nightly feature.
cargo test --features="$FEATURES $LINT nightly";
if [ $CLIPPY = 'yes' ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since CIPPY is always yes, can we remove this condition test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CLIPPY env is only set yes when rust is nightly on the matrix section, so I thought the condition test is still need

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Make sense.

fgfm999 added 2 commits June 21, 2018 18:19
also fix some rustfmt config
@@ -1,5 +1,2 @@
reorder_imports = true
reorder_imports_in_group = true
Copy link
Member

@breezewish breezewish Jun 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these formatting rules removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. These configurations are removed from rustfmt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems these configurations are merged to reorder_imports, as the docs said for reorder_imports:

Reorder import and extern crate statements alphabetically 
in groups (a group is separated by a newline).

@breezewish
Copy link
Member

LGTM

@breezewish breezewish merged commit 2742561 into tikv:master Jun 22, 2018
azdlowry pushed a commit to azdlowry/rust-prometheus that referenced this pull request Sep 10, 2018
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.

4 participants