Commit graph

6535 commits

Author SHA1 Message Date
Philipp Hansch
12b2696634
Add lint writing documentation
This adds a new documentation page that explains how to write Clippy
lints. It guides the reader through creating a `foo` function lint.
2019-03-03 15:03:25 +01:00
bors
9d1792a426 Auto merge of #3834 - ljedrz:HirIdification_fix, r=phansch
HirIdification fixes

Supersedes https://github.com/rust-lang/rust-clippy/pull/3828, enables https://github.com/rust-lang/rust/pull/58836.

As usual, requesting a branch.
2019-03-03 12:26:15 +00:00
Philipp Hansch
68096cf181
fmt fixes 2019-03-03 13:05:39 +01:00
ljedrz
f3363b9cf2 align with rust-lang/rust/#58836 2019-03-01 19:10:14 +01:00
ljedrz
f2587703cc enable rust-lang/rust#58754 2019-03-01 19:10:14 +01:00
bors
8dfabdf11c Auto merge of #3823 - spastorino:place_base, r=flip1995
Place::Local(x) is now Place::Base(PlaceBase::Local(x))

We need to merge this after the beta cut for this https://github.com/rust-lang/rust/pull/58631 to work.
/cc @oli-obk
2019-03-01 16:03:15 +00:00
Santiago Pastorino
77a67c914d
Place::Local(x) is now Place::Base(PlaceBase::Local(x)) 2019-03-01 12:20:17 -03:00
bors
9f2055637e Auto merge of #3833 - mati865:rustup, r=oli-obk
Fix build with the master

https://github.com/rust-lang/rust/pull/58689 broke compiletest.
2019-03-01 12:51:11 +00:00
Mateusz Mikuła
df8a489793 Use temporary branch for compiletest
https://github.com/rust-lang/rust/pull/58689 broke it
2019-03-01 11:54:25 +01:00
bors
cfdf47e8b0 Auto merge of #3831 - martin-t:master, r=flip1995
Use the same <title> as <h1> on gh-pages

I think this makes the page easier to find using firefox's URL bar - it (afaik) searches based on the page's URL and title so if somebody doesn't have it bookmarked but remembers that the page contained "ALL lints" or something similar it's easy to go to it directly without resorting to a search engine.
2019-02-28 19:56:25 +00:00
bors
275a3864b8 Auto merge of #3830 - flip1995:unknown_attribute, r=oli-obk
Error on unknown or deprecated attributes

The reason I decided to not make this a lint is, that unknown attributes are always a hard error in rustc and also in rustfmt, which cannot be turned off by an `allow`. This could have been done by introducing a category which would be forbid-by-default. But that would have introduced a new lint category+group for just one lint and also wouldn't be consistent with rustfmt and rustc.
2019-02-28 19:20:06 +00:00
flip1995
c4eb780156
Add test for unknown Clippy attributes 2019-02-28 20:18:42 +01:00
Martin Taibr
3f7d0c8d75 Use the same <title> as <h1> on gh-pages 2019-02-28 19:17:10 +01:00
flip1995
1463d6f69f
Error an unknown or deprecated Clippy attribute 2019-02-28 16:44:42 +01:00
bors
f69ec96906 Auto merge of #3829 - mikerite:fix-double-parens-suggestions, r=flip1995
Add `rustfmt::skip` to `double_parens` tests
2019-02-28 10:09:00 +00:00
Michael Wright
6e6e39b4a8 Add rustfmt::skip to double_parens tests 2019-02-28 08:02:45 +02:00
bors
ff2798840c Auto merge of #3666 - detrumi:map-or-on-non-copy, r=flip1995
Only suggest map_or for copy types

Fixes #2686
2019-02-27 08:28:48 +00:00
bors
58c0dc1db6 Auto merge of #3826 - mikerite:rustfmt-outer-attr-tests, r=phansch
Add `rustfmt::skip` to outer attr format tests
2019-02-27 06:49:09 +00:00
bors
e46a8df833 Auto merge of #3827 - phansch:rustup, r=Manishearth
Rustup rust-lang/rust#58321

Fixes the build after https://github.com/rust-lang/rust/issues/58321
2019-02-27 06:28:08 +00:00
Philipp Hansch
982a99d2c4
Rustup https://github.com/rust-lang/rust/pull/58321 2019-02-27 07:20:49 +01:00
Michael Wright
11682b4cd2 Add rustfmt::skip to outer attr format tests 2019-02-27 07:41:07 +02:00
bors
6e8931c5f5 Auto merge of #3821 - g-bartoszek:redundant_closure-different-borrow-levels, r=oli-obk
do not trigger redundant_closure when there is a difference in borrow…

… level between closure parameter and "self", fixes  #3802
2019-02-26 17:30:48 +00:00
bors
76f9c22fde Auto merge of #3818 - phansch:update_changelog, r=oli-obk
Update changelog for Rust 1.33

None
2019-02-26 16:40:12 +00:00
Wilco Kusee
eb70a72459
Fix false negative 2019-02-26 17:29:36 +01:00
Wilco Kusee
fec6e55d1d
Attempt to fix false negative 2019-02-26 17:27:41 +01:00
Wilco Kusee
4cf720abbe
Move lint_map_unwrap_or to its own file 2019-02-26 17:27:41 +01:00
Wilco Kusee
54ab22f6db
Only suggest map_or for copy types 2019-02-26 17:27:40 +01:00
bors
0957f7d3b7 Auto merge of #3817 - rust-lang:fix-bool_comparison-on-non-bool, r=oli-obk
Fix `bool_comparison` with non-`bool` expressions

Fixes #3703.
It just moves around the type check that was already there for some comparison to all of them, because if one type isn't `bool`, none of those comparison can be simplified.
2019-02-26 15:51:40 +00:00
Grzegorz
a7f4d41a7d do not trigger redundant_closure when there is a difference in borrow level between closure parameter and "self" 2019-02-26 12:12:27 +01:00
bors
412d41ae86 Auto merge of #3814 - ljedrz:HirIdification_lockstep_upgrade, r=phansch
HirIdify some lints

Unblocks https://github.com/rust-lang/rust/pull/58561 (a part of [rust-lang/rust#57578](https://github.com/rust-lang/rust/pull/57578)). Can we branch it like with https://github.com/rust-lang/rust-clippy/pull/3790? I can rebase on a different commit if need be.

Haven't had time to run tests yet, so I'd wait for Travis 🙈.
2019-02-26 10:43:50 +00:00
ljedrz
c1b65ec363 fix line format 2019-02-26 11:21:07 +01:00
bors
d0717d1f95 Auto merge of #3819 - mikerite:rustfmt-formatting-tests, r=phansch
Add [rustfmt::skip] to formatting lint tests
2019-02-26 07:21:01 +00:00
bors
47e93ff865 Auto merge of #3820 - mikerite:remove-feature-try-from, r=Manishearth
Remove `#[feature(try_from)]`

`try_from` is now stable.
2019-02-26 06:52:34 +00:00
Michael Wright
c9d79c0c5e Remove #[feature(try_from)]
`try_from` is now stable.
2019-02-26 08:43:47 +02:00
Michael Wright
7fd0fbf435 Add [rustfmt::skip] to formatting lint tests 2019-02-26 07:49:46 +02:00
Philipp Hansch
64b400a1f4
Update changelog for Rust 1.33 2019-02-25 22:53:02 +01:00
mcarton
c0c0686a65 Fix bool_comparison with non-bool expressions 2019-02-25 22:31:16 +01:00
bors
50d9473856 Auto merge of #3808 - mikerite:useless-format-suggestions, r=oli-obk
Fix `useless_format` suggestions
2019-02-25 16:21:26 +00:00
bors
2141ebf695 Auto merge of #3816 - g-bartoszek:redundant_closure_for_macros, r=Manishearth
do not trigger redundant_closure for external macros

fixes #3791
2019-02-25 13:46:31 +00:00
Grzegorz
41f197460f redundant_closure does not trigger for external macros 2019-02-25 13:40:28 +01:00
bors
1ac6f4e9ae Auto merge of #3772 - flip1995:ice-3719, r=Manishearth
Fix ICE #3719+#3718 in lint match_ref_pats

Fixes #3719
This conveniently also fixes #3718

The ICE occurs when the match expression was a macro call, where the macro was defined in another file. Since we don't have the ability to reproduce this behavior with our UI tests (AFAIK), I couldn't add a test reproducing this ICE.. However, I added a test which is related to the ICE, to show the new behavior of the lint.

I tested it with the mscheme repo locally and the ICE didn't happen anymore.

r? @matthiaskrgr
2019-02-25 12:30:35 +00:00
bors
cd29740e6e Auto merge of #3805 - martinsp:ice-3747, r=Manishearth
Fix ICE #3747

I'm not sure if this was the correct approach.

I don't know if I put tests/ui/crashses/ice-3747.rs in correct place because the test always passed when I ran it with `cargo test`, even without the fix applied.

If I run that test with `env CLIPPY_TESTS=true cargo run --bin clippy-driver -- -L ./target/debug tests/ui/crashes/ice-3747.rs` then the test correctly fails without the fix applied

fixes #3747
2019-02-25 12:08:43 +00:00
ljedrz
7bc2e1d60d fix: replace wrong id 2019-02-25 11:06:46 +01:00
bors
1233b39ca9 Auto merge of #3815 - phansch:make_private, r=Manishearth
Make DiagnosticWrapper private

It's doesn't have to be public anywhere outside of clippy_lints as far as I can tell.
2019-02-25 06:31:27 +00:00
Philipp Hansch
bd949328f1
Make DiagnosticWrapper private
It's doesn't have to be public anywhere outside of clippy_lints
2019-02-25 07:19:56 +01:00
ljedrz
8dac8a6ba4 HirIdify some lints 2019-02-24 20:49:43 +01:00
bors
e99611bc39 Auto merge of #3811 - rust-lang:test-for-2526, r=mcarton
Add a test for #2526

Closes #2526, which seems to have been fixed at some point, but I couldn't find a test for it.
2019-02-24 17:25:58 +00:00
mcarton
8bcd546648 Add a test for #2526 2019-02-24 18:23:54 +01:00
bors
5833e4d26e Auto merge of #3810 - phansch:refactor/extract_module, r=flip1995
Extract diagnostics module and document some functions

This moves the lint building functions from `utils/mod.rs` to their own
`utils/diagnostics.rs` file. Also adds documentation for three of them.
2019-02-24 15:35:01 +00:00
bors
1ce961f083 Auto merge of #3790 - ljedrz:HirIdify_intravisit, r=phansch
partially HirIdify lints

Enables https://github.com/rust-lang/rust/pull/58232 (a part of https://github.com/rust-lang/rust/pull/57578).
2019-02-24 14:32:55 +00:00