Commit Graph

520 Commits

Author SHA1 Message Date
llogiq
961f9d68a9 Merge pull request #226 from birkenfeld/fixes
Two small fixes/refactorings
2015-08-24 16:21:17 +02:00
llogiq
45533bb03e Merge pull request #220 from Robzz/cast_iusize_improvements
Casts : architecture independent handling of *size types
2015-08-24 10:49:01 +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
R.Chavignat
807dab943b Updated test case for cast lints.
Also improved readability and reworded the messages.
2015-08-22 22:06:58 +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
Manish Goregaokar
29c602c7ac Merge pull request #222 from birkenfeld/type_complexity
types: check for macros in type complexity check
2015-08-22 18:28:45 +05:30
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
371584a637 Merge pull request #221 from Manishearth/fix_const
Fix doubleborrow of refcell in consts.rs
2015-08-22 13:26:26 +05:30
Manish Goregaokar
1334f2ceae Fix doubleborrow of refcell in consts.rs 2015-08-22 13:02:50 +05:30
Manish Goregaokar
f7fb696fee Merge pull request #219 from birkenfeld/type_complexity
[RFC] new lint: type complexity (fixes #93)
2015-08-22 12:32:58 +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
Manish Goregaokar
e1a4248e68 Merge pull request #215 from birkenfeld/type_improvements
Type improvements
2015-08-22 12:13:56 +05:30
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
llogiq
d3793865c4 Merge pull request #208 from Robzz/iss114
Implementation of lossy cast lints (issue #114)
2015-08-21 07:49:19 +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
Manish Goregaokar
af1340e4fe bump crates to 0.0.12 2015-08-20 12:49:49 +05:30
Manish Goregaokar
c91857c62d Merge pull request #209 from Manishearth/where_credit_is_due
give credit where credit is due
2015-08-20 12:31:05 +05:30
llogiq
36ef03158f give credit where credit is due 2015-08-20 08:59:07 +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
85f7f4c9b4 Merge pull request #205 from Manishearth/const
Mul and Div for integers
2015-08-19 13:24:59 +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
llogiq
bbc917fef0 Merge pull request #202 from birkenfeld/unit_cmp
new lint: comparing unit types (fixes #201)
2015-08-19 08:34:19 +02:00
Georg Brandl
8f4499f3ae new lint: comparing unit types (fixes #201) 2015-08-19 08:11:00 +02:00
Manish Goregaokar
7ddc402127 Merge pull request #200 from Manishearth/consts
more small const improvements
2015-08-18 18:41:30 +05:30
llogiq
9f67ba7f8d re-applied birkenfeld's improvements 2015-08-18 14:18:36 +02:00