X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=CONTRIBUTING.md;h=fcf984ccaaf5e448b1d5041f32c818a2c5ecd93e;hb=961c1a5df2aa20e92ee6a8f277f384fd4249366d;hp=3eff20cead74f36cf8acf5498f64db9553becad3;hpb=6937d5581af14b71e23af0db81241a3fea11c70a;p=rust.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3eff20cead7..fcf984ccaaf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Hello fellow Rustacean! Great to see your interest in compiler internals and lin Clippy welcomes contributions from everyone. There are many ways to contribute to Clippy and the following document explains how you can contribute and how to get started. If you have any questions about contributing or need help with anything, feel free to ask questions on issues or -visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in `#wg-clippy` on [Discord](https://discord.gg/rust-lang). +visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in `#clippy` on [Discord](https://discord.gg/rust-lang). All contributors are expected to follow the [Rust Code of Conduct](http://www.rust-lang.org/conduct.html). @@ -90,7 +90,7 @@ Clippy is a [rustc compiler plugin][compiler_plugin]. The main entry point is at pub mod else_if_without_else; // ... -pub fn register_plugins(reg: &mut rustc_plugin::Registry) { +pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry) { // ... reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse); // ... @@ -103,7 +103,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) { } ``` -The [`rustc_plugin::PluginRegistry`][plugin_registry] provides two methods to register lints: [register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass]. +The [`plugin::PluginRegistry`][plugin_registry] provides two methods to register lints: [register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass]. Both take an object that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in every single lint. It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerated by `util/dev update_lints` and you don't have to add anything by hand. When you are writing your own lint, you can use that script to save you some time. @@ -145,13 +145,28 @@ using that version of Rust. You can use [rustup-toolchain-install-master][rtim] to do that: -``` +```bash cargo install rustup-toolchain-install-master -rustup-toolchain-install-master -n master --force +rustup-toolchain-install-master --force -n master -c rustc-dev rustup override set master cargo test ``` +After fixing the build failure on this repository, we can submit a pull request +to [`rust-lang/rust`] to fix the toolstate. + +To submit a pull request, you should follow these steps: + +```bash +# Assuming you already cloned the rust-lang/rust repo and you're in the correct directory +git submodule update --remote src/tools/clippy +cargo update -p clippy +git add -u +git commit -m "Update Clippy" +./x.py test -i --stage 1 src/tools/clippy # This is optional and should succeed anyway +# Open a PR in rust-lang/rust +``` + ## Issue and PR triage Clippy is following the [Rust triage procedure][triage] for issues and pull @@ -193,9 +208,9 @@ or the [MIT](http://opensource.org/licenses/MIT) license. [lint_crate_entry]: https://github.com/rust-lang/rust-clippy/blob/c5b39a5917ffc0f1349b6e414fa3b874fdcf8429/clippy_lints/src/lib.rs [else_if_without_else]: https://github.com/rust-lang/rust-clippy/blob/c5b39a5917ffc0f1349b6e414fa3b874fdcf8429/clippy_lints/src/else_if_without_else.rs [compiler_plugin]: https://doc.rust-lang.org/unstable-book/language-features/plugin.html#lint-plugins -[plugin_registry]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_plugin/registry/struct.Registry.html -[reg_early_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_plugin/registry/struct.Registry.html#method.register_early_lint_pass -[reg_late_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_plugin/registry/struct.Registry.html#method.register_late_lint_pass +[plugin_registry]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_plugin_impl/registry/struct.Registry.html +[reg_early_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_plugin_impl/registry/struct.Registry.html#method.register_early_lint_pass +[reg_late_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_plugin_impl/registry/struct.Registry.html#method.register_late_lint_pass [early_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.EarlyLintPass.html [late_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.LateLintPass.html [toolstate_commit_history]: https://github.com/rust-lang-nursery/rust-toolstate/commits/master @@ -211,3 +226,4 @@ or the [MIT](http://opensource.org/licenses/MIT) license. [homu]: https://github.com/servo/homu [homu_instructions]: https://buildbot2.rust-lang.org/homu/ [homu_queue]: https://buildbot2.rust-lang.org/homu/queue/clippy +[`rust-lang/rust`]: https://github.com/rust-lang/rust