Commit Graph

5684 Commits

Author SHA1 Message Date
Manish Goregaokar
038ec7f5d8 Move get_unwrap to restriction
fixes #3862
2019-03-09 13:48:06 -08:00
bors
920112d723 Auto merge of #3824 - phansch:adding_lints, r=phansch
Add lint writing documentation

[Rendered](https://github.com/phansch/rust-clippy/blob/adding_lints/doc/adding_lints.md)

This adds a new documentation page that explains how to write Clippy
lints. It guides the reader through creating a `foo` function lint.

I plan to iterate a bit more on the prose of some sections, but I think the
general structure is fine now, so I'm looking forward to feedback =)

One thing I'm not sure about: I felt like this is too big for CONTRIBUTING.md
so I put it into a new `doc/` directory. I can imagine having more
documentation in the future, so we might even want to create a book using
mdbook instead? Or should everything go into CONTRIBUTING.md?

Further things left to do:

- [x] Link from CONTRIBUTING.md
- [x] Remove things covered in this guide from CONTRIBUTING.md
- [x] Section about `clippy::author` attribute
- [x] Run `remark-lint` on CI over the `doc` directory and fix things
2019-03-09 15:05:38 +00:00
bors
ccfbfb8097 Auto merge of #3860 - phansch:refactor_out_opt_def_id, r=flip1995
Refactor: Remove utils::opt_def_id

This removes some indirection. Probably this method was uplifted to
rustc at some point?
2019-03-09 12:05:41 +00:00
bors
8213d252ae Auto merge of #3861 - flip1995:rollup, r=flip1995
Rollup of 3 pull requests

Successful merges:

 - #3851 (Refactor: Extract `trait_ref_of_method` function)
 - #3852 (Refactor: Cleanup one part of assign_ops lint)
 - #3857 (Document match_path, improve match_qpath docs)

Failed merges:

r? @ghost
2019-03-09 11:41:26 +00:00
Philipp Krones
c32135a87f
Rollup merge of #3857 - phansch:document_path_qpath, r=flip1995
Document match_path, improve match_qpath docs

Inching towards enabling `#[deny(missing_docs)]` in utils 📜
2019-03-09 12:24:44 +01:00
Philipp Krones
f69351e995
Rollup merge of #3852 - phansch:refactor_assign_ops, r=flip1995
Refactor: Cleanup one part of assign_ops lint

Removes a lot of indentation and separates lint emission from lint
logic. Only touches the `hir::ExprKind::AssignOp` part of the lint.
2019-03-09 12:24:43 +01:00
Philipp Krones
1902384d15
Rollup merge of #3851 - phansch:refactor_trait_stuff, r=flip1995
Refactor: Extract `trait_ref_of_method` function

This pattern was used in three places after #3844, so I think it's worth moving it into `utils/mod.rs` and documenting it.
2019-03-09 12:24:42 +01:00
bors
bd6b5a1a36 Auto merge of #3854 - ljedrz:rustc_58992, r=phansch
Align with rust-lang/rust/#58992

Some adjustments needed after the most recent round of HirIdification.
2019-03-08 17:10:52 +00:00
Philipp Hansch
9d97ed6faa
Refactor: Remove utils::opt_def_id
This removes some indirection. Probably this method was uplifted to
rustc at some point?
2019-03-08 14:14:41 +01:00
Philipp Hansch
f04acdd463
Document match_path, improve match_qpath docs 2019-03-08 09:50:20 +01:00
Philipp Hansch
9494f22f06
cargo fmt 2019-03-08 09:44:22 +01:00
Philipp Hansch
131b89b54e
fmt 2019-03-08 09:43:36 +01:00
Philipp Krones
837d675afd
Update clippy_lints/src/utils/mod.rs
Co-Authored-By: phansch <dev@phansch.net>
2019-03-08 09:40:12 +01:00
Philipp Hansch
65694cc6c8
Fix doctest 2019-03-08 09:10:41 +01:00
Philipp Hansch
5c9221f880
Refactor: Cleanup one part of assign_ops lint
Removes a lot of indentation and separates lint emission from lint
logic. Only touches the `hir::ExprKind::AssignOp` part of the lint.
2019-03-08 09:01:29 +01:00
Philipp Hansch
34685a5f60
Update comment location 2019-03-08 08:50:13 +01:00
bors
9702b3d2c0 Auto merge of #3856 - mikerite:clippy-dev-enchancement-1, r=phansch
Improve Clippy dev help

+ Print help if no subcommand is supplied
+ Make a short version of `update_lints` help for the subcommand listing
2019-03-08 07:36:32 +00:00
bors
90d4350055 Auto merge of #3855 - rchaser53:issue-3849, r=flip1995
Remove an unused binary file

related https://github.com/rust-lang/rust-clippy/pull/3853
I'm sorry.
2019-03-08 07:16:28 +00:00
Michael Wright
acd6d4d094 Improve Clippy dev help
+ Print help if no subcommand is supplied
+ Make a short version of `update_lints` help for the subcommand listing
2019-03-08 07:45:31 +02:00
rChaser53
fa2691b179
Remove an unused binary file 2019-03-08 08:14:29 +09:00
ljedrz
5d78250c75 align with rust-lang/rust/#58992 2019-03-07 21:51:05 +01:00
bors
77ba5045d7 Auto merge of #3853 - rchaser53:issue-3849, r=flip1995
fix missing a semicolon

related: https://github.com/rust-lang/rust-clippy/issues/3849
2019-03-07 15:02:53 +00:00
rchaser53
ae787d954e fix missing a semicolon 2019-03-07 23:26:47 +09:00
Philipp Hansch
e1d47cd5f1
Refactor: Extract trait_ref_of_method function 2019-03-07 08:17:43 +01:00
bors
0d8937299e Auto merge of #3850 - mikerite:rustfmt-tests, r=phansch
More test improvements
2019-03-07 07:05:35 +00:00
Michael Wright
7b948232ba Enable rustfix on unused_unit tests 2019-03-07 08:26:53 +02:00
Michael Wright
fbcf7eefb9 Add [rustfmt::skip] to unused_unit test 2019-03-07 08:13:59 +02:00
Michael Wright
131c8f6bf2 Add [rustfmt::skip] to doc_markdown tests 2019-03-07 08:03:15 +02:00
bors
00baf7a111 Auto merge of #3803 - felix91gr:master, r=oli-obk
Cognitive Complexity (step 1 out of 3+): name changes

Following up on #3793

**Overall checklist:**

1. **Name changes**
2. MVP of functionality
3. Tests

After this PR, we will start working on the implementation itself.
2019-03-06 13:41:31 +00:00
Félix Fischer
ddc718087f Renamed: Cyclomatic Complexity -> Cognitive Complexity
* Ran automatic naming update

* Formalized rename of `cyclomatic_complexity` to `cognitive_complexity`
** Added the rename to `lib.rs`
** Added rename test

* Added warning for deprecated key `cyclomatic_complexity_threshold` and tests for it

* Added deprecation status for Clippy's builtin attribute

* Updated tests for new builtin attribute renaming
2019-03-06 10:07:38 -03:00
bors
15d1731ce8 Auto merge of #3845 - euclio:unused-comments, r=phansch
move lint documentation into macro invocations

This PR moves lint documentation inside `declare_clippy_lint!` macro invocations, to avoid triggering the `unused_doc_comments` lint once it's modified in rust-lang/rust#57882. This PR is necessary to unblock that work, since the large number of warnings generated in `clippy_lints` causes Travis to hit the log length limit.

This PR also updates the documentation and website generation script.

It would be nice to get a clippy update in the Rust repo once this is merged.

cc @phansch
2019-03-06 06:48:26 +00:00
bors
400ee06789 Auto merge of #3846 - mikerite:fix-3839, r=phansch
Ensure `expect_fun_call` bad suggestion is fixed

Closes #3839
2019-03-06 05:54:48 +00:00
Michael Wright
464ed58861 Ensure expect_fun_call bad suggestion is fixed
Closes #3839
2019-03-06 07:00:05 +02:00
Andy Russell
a9de64a151
fix or ignore failing doc tests 2019-03-05 18:45:08 -05:00
Andy Russell
fe96ffeac9
move lint documentation into macro invocations 2019-03-05 18:45:08 -05:00
bors
a8f61e70a8 Auto merge of #3844 - phansch:const_fn_external_macro, r=oli-obk
Fix two missing_const_for_fn false positives

Fixes #3841

* Fixes false positive in external macros
* Fixes false positive when implement trait methods
2019-03-05 10:12:53 +00:00
Philipp Hansch
15cba2e956
Fix missing_const_for_fn for impl trait methods 2019-03-05 08:11:55 +01:00
Philipp Hansch
b87f5bc55a
Don't trigger missing_const_for_fn in external macros
As reported in #3841. Only fixes the part where it triggers on the
`derive`.
2019-03-04 22:56:33 +01:00
Philipp Hansch
3c67c629fd
Add rustc nightly docs to cheatsheet 2019-03-04 20:43:11 +01:00
Philipp Hansch
d1caaa47c0
s/you/we; One more checklist item 2019-03-04 20:39:28 +01:00
bors
caccf8bd4c Auto merge of #3838 - mati865:rustup, r=phansch
Upgrade compiletest_rs to 0.3.19
2019-03-03 15:09:00 +00:00
Mateusz Mikuła
da2cf8764a Upgrade compiletest_rs to 0.3.19 2019-03-03 16:02:59 +01:00
Philipp Hansch
8d2cbb94d4
Add the rustc guide to the cheatsheet 2019-03-03 15:03:25 +01:00
Philipp Hansch
23f3256e96
More text fixes after Test section was moved to top 2019-03-03 15:03:25 +01:00
Philipp Hansch
0da3521eb6
Reword 'Setup' a bit 2019-03-03 15:03:25 +01:00
Philipp Hansch
b03011480c
Note that stderr files don't have to be created manually 2019-03-03 15:03:25 +01:00
Philipp Hansch
81f47e1ffc
Author lint usage via playground 2019-03-03 15:03:25 +01:00
Philipp Hansch
680dc8a105
Run remark in doc directory, too. 2019-03-03 15:03:25 +01:00
Philipp Hansch
1eac53b06b
Cleanup 'Writing code' in CONTRIBUTING.md
This is now all included in `doc/adding_lints.md`
2019-03-03 15:03:25 +01:00
Philipp Hansch
68d04eda7b
Copy from CONTRIBUTING.md: author lint, rustfix tests, rustfmt
And adapt the wording a bit so that it fits in the overall guide.
2019-03-03 15:03:25 +01:00