Commit Graph

98 Commits

Author SHA1 Message Date
R.Chavignat
807dab943b Updated test case for cast lints.
Also improved readability and reworded the messages.
2015-08-22 22:06:58 +02:00
R.Chavignat
f1255d5f5d Casts : work in progress handling *size separately 2015-08-22 02:46:22 +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
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
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
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
llogiq
a2ee637be6 added test and fixed negativity check in Partial{Eq, Ord} impl 2015-08-17 16:24:57 +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
e354fdc3e8 added regression test for #189 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
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
e1438e7010 copied over cmp_owned fix from master 2015-08-16 16:13:44 +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
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
f23af0cfd5 changed const to consts to avoid keyword, added test, fixed a lot of bugs 2015-08-14 17:14:54 +02:00
llogiq
5d99ebec72 fixed false positives (at the cost of some false negatives) 2015-08-14 14:37:12 +02:00
llogiq
ffda91a8c7 removed String::from_str(..) to fix build with 1.4.0-nightly/2015-08-14 2015-08-14 14:26:57 +02:00
llogiq
dece5a6cb5 added empty line test 2015-08-13 23:18:34 +05:30
llogiq
f4b5d21533 added a few unit tests to trim_multiline 2015-08-13 23:18:34 +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
Georg Brandl
9578403638 new lint: looping over x.iter() or x.iter_mut() (fixes #157) 2015-08-13 16:31:16 +02:00
Georg Brandl
8a98736f51 spelling fix, rework needless_bool with snippet (fixes #150) 2015-08-13 15:31:16 +02:00
Andre Bogus
f67175b4cd fixed error messages in compile-fail test 2015-08-13 11:38:39 +02:00
llogiq
f9e851e212 pulled strings passes together, added more tests 2015-08-13 11:36:39 +02:00
llogiq
0b08e9e83e added string_add lint and fixed string_add_assign + test 2015-08-13 11:36:39 +02:00
Manish Goregaokar
8dfa02938d Merge branch 'pr-149' 2015-08-13 13:00:29 +05:30
Manish Goregaokar
510ea0c5e5 Merge branch 'pr-140'
Conflicts:
	src/lib.rs
2015-08-13 12:52:14 +05:30
Georg Brandl
7aee04878f tests: use fragment of lint text for error checking
(Did not touch strings.rs, which is fixed by @llogiq's PR)
2015-08-13 08:12:07 +02:00
Georg Brandl
5952a29543 lifetimes test: use explicit message prefix 2015-08-13 07:51:24 +02:00
Georg Brandl
2f7693094f lifetimes lint: include support for lifetimes as generic params 2015-08-13 06:43:25 +02:00
Georg Brandl
b349f9e88d new lint for needless lifetimes (fixes #115) 2015-08-13 06:35:40 +02:00
Georg Brandl
f6090909d3 new lint: using for i in 0..x { .. vec[i] .. } instead of iterator (fixes #3) 2015-08-13 06:34:08 +02:00
Georg Brandl
3044d3d633 unicode: add lint against non-ascii chars in literals (Allow by default), #85 2015-08-12 20:36:35 +02:00
Manish Goregaokar
c58f803511 Merge branch 'pr-138'
Conflicts:
	src/lib.rs
2015-08-12 21:22:01 +05:30