Commit Graph

330 Commits

Author SHA1 Message Date
Andre Bogus
55729b7caa dogfooding a newly caught problem 2015-09-06 10:59:06 +02:00
Andre Bogus
54393f0ef5 More strict macro check 2015-09-06 10:53:55 +02:00
llogiq
3848756be0 Made min_max Warn by default 2015-09-05 14:20:35 +02:00
llogiq
b90e4c7bd5 hir naming, removed lookup, match full path 2015-09-05 13:15:18 +02:00
llogiq
cd91110ec0 new lint: min_max 2015-09-05 12:46:34 +02:00
llogiq
28212e4981 fixed dogfood by using snippet instead of the (escaped) literal string 2015-09-04 14:24:49 +02:00
llogiq
e11fd49b1c Unicode lints, second attempt: Lint whole strings, help with replacement 2015-09-04 16:18:46 +05:30
Manish Goregaokar
af4d7f9b60 Merge pull request #298 from birkenfeld/as_mut
methods: allow &mut self for as_ methods
2015-09-04 16:16:58 +05:30
Georg Brandl
d659d039b6 methods: allow &mut self for as_ methods 2015-09-04 07:56:52 +02:00
Manish Goregaokar
eca185438b Update rust to 0efb9dab8c7c07fa28e9df0eccc5c07ea3c17fbb (HIR+lints, Thu Sep 3 18:59:56 2015 +0530)
fixes #294
2015-09-03 23:12:19 +05:30
llogiq
cb571bf2e2 also ignore functions 2015-09-03 10:57:11 +02:00
Manish Goregaokar
fbdba7f915 Fix ICE 2015-09-03 02:15:02 +05:30
Georg Brandl
7649d1c2a8 shadow: complete coverage of "contains_self" checker 2015-09-02 18:24:46 +02:00
Georg Brandl
6b589681c9 methods: allow multiple self kinds for "is_" methods
These can be static method predicates.  (Found one in rust-copperline,
called Term::is_unsupported_term().)
2015-09-02 17:14:27 +02:00
Georg Brandl
846c164709 don't say "did you mean to" - use the standard "consider..."
"Did you mean to ..." sounds a bit condescending to me, since
if I meant to write "if let" I probably wouldn't have written "match" :)
2015-09-02 16:46:14 +02:00
Manish Goregaokar
73c34e12b3 Only handle ranges starting with 0 for needless_range_loop (fixes #279) 2015-09-02 16:11:54 +05:30
llogiq
0c7f05dd76 check item name for eq, fixes #268 2015-09-02 10:30:11 +02:00
llogiq
0fb7d1d2d9 reporting improvements 2015-09-02 08:19:47 +02:00
llogiq
bc1eb84810 match region patterns 2015-09-02 07:56:13 +02:00
llogiq
1ab733cfa1 extended pattern matching 2015-09-02 07:55:07 +02:00
llogiq
08fb953e1a extended pattern matching 2015-09-02 01:36:37 +02:00
Georg Brandl
5264196538 methods: try to allow value self when type is Copy (fixes #273) 2015-09-01 21:08:49 +02:00
Georg Brandl
1007864198 new lint: self conventions for certain method names (fixes #267) 2015-09-01 18:52:48 +02:00
Georg Brandl
88dd38de87 lib: add clippy_pedantic group with all Allow by default lints (fixes #265) 2015-09-01 18:05:28 +02:00
Frank Denis
833493cf07 FnKind::FkClosure -> FnKind::Closure 2015-09-01 14:28:23 +02:00
Manish Goregaokar
d3da9f6c81 Merge branch 'pr-260'
Conflicts:
	src/lib.rs
2015-08-31 15:06:53 +05:30
Georg Brandl
e33bef685e lifetimes lint: walk type bounds as well as types (fixes #253, again) 2015-08-31 11:26:41 +02:00
Georg Brandl
0217fb81ee loops: fix false positives with explicit_iter_loop and references (fixes #261) 2015-08-31 08:29:40 +02:00
Georg Brandl
d499d2a9a7 loops: remove debugging print 2015-08-31 08:20:39 +02:00
Georg Brandl
03abe275b2 new lint: unnecessary patterns (x@_ -> x) 2015-08-30 19:02:30 +02:00
Tim Neumann
ef0c933550 add precedence_negative_literal lint 2015-08-30 17:34:48 +02:00
Georg Brandl
16df79a054 new lint: using collect() to just exhaust an iterator
Should use a for loop instead.
2015-08-30 13:10:59 +02:00
Georg Brandl
b72ef5a173 new lint: loop-match-break, which could be while-let (fixes #118) 2015-08-30 12:40:39 +02:00
Georg Brandl
6461fb3308 lifetimes lint: take "where" clauses into account (fixes #253)
If a where clause is present and has lifetimes mentioned, just bail out.
2015-08-30 09:58:26 +02:00
llogiq
621818e606 rustup, the ExpnInfo stuff changed 2015-08-28 14:35:20 +02:00
Manish Goregaokar
c3d4eb5bbd Merge branch 'pr-228'
Conflicts:
	README.md
	src/methods.rs
2015-08-27 15:25:56 +02:00
Manish Goregaokar
5159e034a6 appease the dogfood gods 2015-08-27 04:40:01 +05:30
Manish Goregaokar
9ebcd0bf29 More macro checks 2015-08-27 04:33:59 +05:30
Manish Goregaokar
7a1082d916 Merge pull request #239 from jedisct1/nightly
Changes for rust-nightly after #27856
2015-08-27 03:44:30 +05:30
Georg Brandl
bb552dc96f eta_reduction: fix false positive for unsafe fns (fixes #243) 2015-08-26 17:09:51 +02:00
llogiq
6984d2bc09 added helpful links to lints that have wiki entries 2015-08-26 14:33:51 +02:00
llogiq
5e341715cd Merge pull request #240 from Manishearth/shadow_scope
correct scoping for shadow lints
2015-08-25 23:56:57 +02:00
llogiq
51a211503d correct scoping for shadow lints 2015-08-25 23:48:22 +02:00
Manish Goregaokar
c9b849bdc8 Merge pull request #237 from birkenfeld/iter_fix
loops: use a whitelist for the "x.iter() -> &x" lint (fixes #236)
2015-08-26 03:16:49 +05:30
Frank Denis
92db00863f Changes for rust-nightly after #27856 2015-08-25 23:21:38 +02:00
Manish Goregaokar
6df102cdab Merge pull request #238 from birkenfeld/to_string_fix
methods: suggest correct replacement for `to_string()` (fixes #232)
2015-08-26 02:43:19 +05:30
llogiq
9012d8f197 fixed false positives on structs/enum variants 2015-08-25 20:11:03 +02:00
llogiq
56cdd58ad2 Merge branch 'master' of https://github.com/Manishearth/rust-clippy into shadow 2015-08-25 20:09:50 +02:00
llogiq
974ceefc1e shadowing detection 2015-08-25 20:06:09 +02:00
llogiq
544c14f3ef Merge pull request #230 from birkenfeld/eq_op_fix
eq_op: cut back to expressions that are guaranteed side effect free
2015-08-25 19:32:12 +02:00
Georg Brandl
6fa34cca29 methods: suggest correct replacement for to_string() (fixes #232) 2015-08-25 18:39:21 +02:00
Georg Brandl
ffed5b0b23 loops: use a whitelist for the "x.iter() -> &x" lint (fixes #236) 2015-08-25 18:28:05 +02:00
llogiq
bd22521af2 shadowing detection 2015-08-25 17:36:46 +02:00
Georg Brandl
b13d318f48 all: remove unneeded deref and/or ref operations 2015-08-25 17:35:20 +02:00
Georg Brandl
88047a0953 collapsible_if: remove extraneous note output
This was probably a debug addition.
2015-08-25 17:35:20 +02:00
Georg Brandl
92a3394065 all: remove unneeded deref and/or ref operations 2015-08-25 14:41:35 +02:00
llogiq
5225feceaa shadowing detection 2015-08-25 13:40:26 +02:00
Georg Brandl
d5c808acd0 collapsible_if: remove extraneous note output
This was probably a debug addition.
2015-08-25 13:27:21 +02:00
Georg Brandl
81ef3da03c methods: people might be using to_string() to make a copy; add a hint for that 2015-08-25 12:46:29 +02:00
Georg Brandl
64cd1fc6ba eq_op: cut back to expressions that are guaranteed side effect free
fixes #229
2015-08-25 12:34:37 +02:00
Georg Brandl
56e8db476c new lint: inherent methods that should be trait impls (fixes #218) 2015-08-25 11:10:42 +02:00
llogiq
209e6981a3 shadowing detection 2015-08-24 16:59:02 +02:00
llogiq
961f9d68a9 Merge pull request #226 from birkenfeld/fixes
Two small fixes/refactorings
2015-08-24 16:21:17 +02:00
Georg Brandl
cc8f33d915 ranges: remove unneeded as_str() 2015-08-23 16:34:23 +02:00
Georg Brandl
c8a2e848ab utils: extract utility method for matching trait method calls from loops 2015-08-23 16:32:50 +02:00
R.Chavignat
3af2e3ba85 Refactored CastPass. 2015-08-23 06:26:31 +02:00
R.Chavignat
e80f2470b7 Merge branch 'master' into cast_iusize_improvements 2015-08-23 00:08:16 +02:00
R.Chavignat
79ef13592e Completed the implementation of *size handling.
Added some more cases to the test, and implemented a new lint,
cast_possible_wrap, triggered when casting from an unsigned type to a
signed type of the same size.
2015-08-22 23:49:03 +02:00
llogiq
5a5b1ba96b Merge pull request #216 from birkenfeld/match_pass
new lint: using &Ref patterns instead of matching on *expr (fixes #187)
2015-08-22 19:06:48 +02:00
Georg Brandl
7580da306e matches: special message for this case
match &e { &Pat1 => {}, &Pat2 => {}, ... }

(inspired by dogfood fixes)
2015-08-22 14:34:39 +02:00
Georg Brandl
8f1a237493 &-matches: dogfood fixes! 2015-08-22 14:34:39 +02:00
Georg Brandl
017dac2301 new lint: using &Ref patterns instead of matching on *expr (fixes #187) 2015-08-22 14:34:39 +02:00
Georg Brandl
5403e82681 matches: new module, move single_match lint there 2015-08-22 14:34:39 +02:00
Georg Brandl
1587256dc4 types: check for macros in type complexity check 2015-08-22 14:30:53 +02:00
Manish Goregaokar
1334f2ceae Fix doubleborrow of refcell in consts.rs 2015-08-22 13:02:50 +05:30
Georg Brandl
630bb76f96 new lint: type complexity (fixes #93)
Still very naive, but it's a start.
2015-08-22 08:57:11 +02:00
Georg Brandl
e92bf84a53 ptr_arg: fix panic when pattern type is not in tcx 2015-08-22 08:57:11 +02:00
R.Chavignat
f1255d5f5d Casts : work in progress handling *size separately 2015-08-22 02:46:22 +02:00
Georg Brandl
8a10440641 utils: add match_type() helper function
which saves one level of matching when checking for type paths
2015-08-21 19:24:38 +02:00
Georg Brandl
a437936d49 all: put often used DefPaths into utils as consts
Also remove the "use xxx;" blocks to ensure import paths don't change.
They don't work anyway since stuff may still be re-exported at the old
location, while we need the "canonical" location for the type checks.

Plus, the test suite catches all these cases.
2015-08-21 19:23:05 +02:00
Georg Brandl
707e95f2e5 types: use middle::ty types instead of ast types
This gets rid of the match_ty_unwrap function.
2015-08-21 19:21:19 +02:00
Georg Brandl
b2df15d65a ptr_arg improvements (fixes #214)
* do not trigger on mutable references
* use "real" type from ty, not AST type
2015-08-21 19:21:18 +02:00
llogiq
6ffe1ed337 Merge pull request #212 from Manishearth/eq_op_const
Eq op const
2015-08-21 12:30:53 +02:00
llogiq
a22b3cdcee const folding for eq_op 2015-08-21 12:26:03 +02:00
llogiq
4dcbad1b08 const folding for eq_op 2015-08-21 12:19:07 +02:00
R.Chavignat
ad0bc66402 Added support for isize/usize in the CastPass lint pass.
Extracted the match that determines an integer types's size in a
utility function and implemented support for usize/isize.
Added a needed feature to the crate root.
Added some tests to cover those cases, and a test I previously forgot.
Silenced two errors signaled by dogfood.sh in unicode.rs.
2015-08-21 03:03:37 +02:00
R.Chavignat
dbc9b7f46e Reworked the error messages for more heplfulness.
Renamed the cast_possible_overflow lint to cast_possible_truncation,
and updated the error message, readme and crate root accordingly.
Added some more information to the message for the cast_precision_loss
lint.
Updated the test case to reflect changes.
2015-08-20 22:44:40 +02:00
R.Chavignat
ab481e5cb1 Refactored the CastPass lints. 2015-08-20 21:37:37 +02:00
R.Chavignat
ff28dd324e Fixed a little oversight. 2015-08-20 14:50:26 +02:00
R.Chavignat
14528d433a Simplified reexported ast::* type paths.
Also removed trailing whitespaces.
2015-08-20 14:46:40 +02:00
R.Chavignat
b417f01ed8 Also test that the CastExpr's right arm is numeric. 2015-08-20 14:36:26 +02:00
R.Chavignat
93d9249f76 Moved allow(unknown_lints) to crate level. 2015-08-20 14:25:08 +02:00
R.Chavignat
1846581baa Added examples to lint descriptions. 2015-08-20 14:24:26 +02:00
R.Chavignat
993239d33a Initial implementation of lossy cast lints.
Introduces 3 lints :
  cast_possible_overflow
  cast_precision_loss
  cast_sign_loss
Add a compile-test test case.
Fix errors spotted by dogfood script.
2015-08-20 01:04:06 +02:00
llogiq
150840667e Merge pull request #204 from Manishearth/bit-mask
Extend and correct the ineffective_bit_mask check
2015-08-19 13:25:43 +02:00
llogiq
973d5e5c6b Mul and Div for integers 2015-08-19 11:58:59 +02:00
llogiq
98d24b5b56 fixed #203 and #197 2015-08-19 09:39:03 +02:00
Georg Brandl
8f4499f3ae new lint: comparing unit types (fixes #201) 2015-08-19 08:11:00 +02:00
llogiq
9f67ba7f8d re-applied birkenfeld's improvements 2015-08-18 14:18:36 +02:00
llogiq
6e0c103133 more small const improvements 2015-08-18 12:26:01 +02:00