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
Georg Brandl
49ad73f6e4
consts: minor improvements
2015-08-18 11:07:13 +02:00
Georg Brandl
7f52239cab
consts: convert to using a struct with state
...
Struct has the context reference (as an Option) and the
needed_resolution flag.
2015-08-17 19:58:21 +02:00
Georg Brandl
a2dcbfea65
const eval: implement ! for integers
2015-08-17 16:45:56 +02:00
llogiq
a2ee637be6
added test and fixed negativity check in Partial{Eq, Ord} impl
2015-08-17 16:24:57 +02:00
llogiq
c47402416b
Added bit operations to const folding
2015-08-17 15:11:36 +02:00
llogiq
4394362836
dogfooding
2015-08-17 13:23:17 +02:00
llogiq
9f134f8e95
added PartialEq/PartialOrd to ConstantVariant, used to implement comparing binops
2015-08-17 13:18:14 +02:00
llogiq
0e67c0134f
make float_cmp check for zero
2015-08-17 12:08:45 +02:00
llogiq
fb715ce45d
fix 189, fixed a few warnings, ==/!= for consts, refactored consts test
2015-08-17 12:08:45 +02:00
Manish Goregaokar
4f1fcd4d5b
Merge pull request #184 from Manishearth/identity_op
...
Identity op now uses const folding, no longer follows const bindings
2015-08-17 14:35:45 +05:30
Manish Goregaokar
65deb956f1
Merge pull request #186 from birkenfeld/fix
...
loops: fix two trailing periods in lint msgs
2015-08-17 11:05:02 +05:30
Georg Brandl
caeb72c47b
loops: fix two trailing periods in lint msgs
2015-08-17 07:30:33 +02:00
Georg Brandl
e9a41e2374
new lint: lint when iterating over any Iterator::next() result ( fixes #182 )
2015-08-17 07:28:40 +02:00
llogiq
759b45a46d
made is_negative(..) public (+doctest), fixed identity_op and precedence
2015-08-16 23:09:56 +02:00
llogiq
c4b07ead17
Merge pull request #179 from nweston/step-by-zero
...
New lint: Range::step_by(0) (fixes #95 )
2015-08-16 20:12:52 +02:00
Nathan Weston
23a38c4170
New lint: Range::step_by(0) ( fixes #95 )
...
Uses type information so it can detect non-literal ranges as well
(Range or RangeFrom -- the other range types don't have step_by).
2015-08-16 12:58:54 -04:00
llogiq
4244f2479f
dogfooding, part 2
2015-08-16 16:09:00 +02:00
llogiq
fe0de07b28
dogfooded
2015-08-16 16:05:51 +02:00
llogiq
03c7d7074d
With working test now
2015-08-16 15:56:09 +02:00
Manish Goregaokar
164907ece2
restrict toplevel_ref_arg to only functions ( fixes #170 )
2015-08-16 17:24:03 +05:30
Georg Brandl
64954283c1
add some imports to guard against crate moves
2015-08-16 09:03:06 +02:00
Georg Brandl
47b605304d
all: organize imports
...
* remove unused imports
* separate external and internal imports
* consistent import of rustc::lint
* move #[allow(unused_imports)] to local impl
2015-08-16 08:55:34 +02:00
Georg Brandl
997f345046
all: remove unneeded as_str() calls for ast::Name
...
Name has PartialEq and Display impls that do what we want.
2015-08-16 08:38:47 +02:00
Manish Goregaokar
f494f14aa6
Merge pull request #177 from birkenfeld/if_let_mini_fix
...
misc: fix check for unit body in "match -> if let" lint (fixes #172 )
2015-08-15 14:12:34 +05:30
Georg Brandl
542bf8d50e
misc: fix check for unit body in "match -> if let" lint ( fixes #172 )
2015-08-15 09:56:15 +02:00
Georg Brandl
b299433de3
lifetimes: fix case with one unnamed and one static ref ( fixes #171 )
2015-08-15 09:36:07 +02:00
llogiq
b1920cb21c
Merge pull request #174 from birkenfeld/small_fixes
...
methods: allow Option.unwrap by default
2015-08-15 08:27:33 +02:00
Georg Brandl
137a9f3def
methods: allow Option.unwrap by default
2015-08-15 07:23:04 +02:00
llogiq
f23af0cfd5
changed const to consts to avoid keyword, added test, fixed a lot of bugs
2015-08-14 17:14:54 +02:00
llogiq
b6ac44d5b2
Removed #![allow(redundant_closure)] on eq_op
2015-08-14 15:00:04 +02:00
llogiq
5d99ebec72
fixed false positives (at the cost of some false negatives)
2015-08-14 14:37:12 +02:00
Manish Goregaokar
763ae1f3ae
Fix dogfood
2015-08-13 23:20:00 +05:30
Manish Goregaokar
5ce8e7ba85
trim_multiline: ignore empty lines
2015-08-13 23:18:34 +05:30
Manish Goregaokar
fbbb44d93b
Handle tabs
2015-08-13 23:18:34 +05:30
Manish Goregaokar
83487c060f
Add trim_multiline utility ( fixes #139 )
2015-08-13 23:18:33 +05:30
Manish Goregaokar
847070e19d
Merge pull request #151 from birkenfeld/needless_bool_msg
...
spelling fix, rework needless_bool with snippet (fixes #150 )
2015-08-13 23:17:18 +05:30
Manish Goregaokar
3cf5c36296
Address review comments, move to travis
2015-08-13 21:45:50 +05:30
Georg Brandl
49e51fe65a
lifetimes: try to fix w.r.t. lifetimes from parent scopes ( fixes #162 )
2015-08-13 21:45:42 +05:30
Manish Goregaokar
09db7f3fee
fix
2015-08-13 21:45:42 +05:30
Manish Goregaokar
c2bdc85715
oh the irony
2015-08-13 21:45:41 +05:30
Manish Goregaokar
5eab397e7c
Some fixes from dogfooding clippy
2015-08-13 21:45:41 +05:30