Commit Graph

225 Commits

Author SHA1 Message Date
Matthias Krüger
712d2d4fa1 rustup, fix breakage introduced by https://github.com/rust-lang/rust/pull/53581 2018-08-22 23:34:52 +02:00
Manish Goregaokar
76321d3300 codemap -> source_map
https://github.com/rust-lang/rust/pull/52953
2018-08-19 19:06:54 -07:00
Matthias Krüger
88d693918f docs: add more suggestions on how to fix clippy findings to the online lint list. 2018-08-12 11:29:44 +02:00
flip1995
12f2d61fa9
Replace cfg_attr(rustfmt... thingies 2018-08-02 23:04:20 +02:00
Philipp Hansch
d7ffaab0fb
Merge pull request #2968 from phansch/first_an_ICE_and_then_some_ice_cream
Fix ICE with 'while let Some(..) = x.iter()'
2018-08-01 06:18:34 +01:00
Philipp Hansch
946340acfe
Fix ICE with 'while let (..) = x.iter()' 2018-07-29 11:00:26 +02:00
Matthias Krüger
2665f10662 fix a bunch of typos found by codespell 2018-07-25 20:02:52 +02:00
Dale Wijnand
a1cce2d06a
Inline utils::in_external_macro 2018-07-24 10:38:58 +01:00
Oliver Schneider
afd91248ed Rustup 2018-07-23 13:01:12 +02:00
Manish Goregaokar
5918a3fc1e Remove import of if_chain 2018-07-20 00:50:02 -07:00
Manish Goregaokar
5d74e2096b Remove import of rustc 2018-07-19 00:53:23 -07:00
Oliver Schneider
6992937002 Update for hir renamings in rustc 2018-07-16 15:07:39 +02:00
csmoe
8cf463fe93 StmtKind 2018-07-16 11:48:33 +02:00
csmoe
5d4102ee78 BinOpKind 2018-07-16 11:46:37 +02:00
csmoe
1bd17e4fa2 ExprKind 2018-07-16 11:46:37 +02:00
Oliver Schneider
1e9f076254 Ignore spans when comparing expressions 2018-07-15 00:00:27 +02:00
Mateusz Mikuła
48cb6e273e Rustup 2018-06-29 09:49:05 +02:00
flip1995
d9a80d2f84
Resolve field, struct and function renaming
Addresses the errors produced by (re)moving, merging or renaming
structs, fields and methods by rust-lang/rust#48149 and rust-lang/rust#51580
2018-06-25 12:25:20 +02:00
Wim Looman
621fdcc3bc Dogfood new trivially_copy_pass_by_ref lint 2018-06-15 16:53:34 +02:00
Fabian Zaiser
81821acd59 Implement lint that checks for unidiomatic unwrap() (fixes #1770)
This checks for things like

    if x.is_some() {
        x.unwrap()
    }

which should be written using `if let` or `match` instead.

In the process I moved some logic to determine which variables are
mutated in an expression to utils/usage.rs.
2018-06-08 05:29:25 +02:00
Mateusz Mikuła
424a33720d Run rustfix 2018-05-30 10:15:50 +02:00
François Mockers
5379fc1b28 better parsing of condition in while loop for mutability
allow condition to be a block: by calling visit_expr of the visitor directly on the condition instead of walk_expr on the whole expression, we bypass the match to ExprWhile that calls visit_expr on the condition and visit_block on the body. This allow to re-enable visit_block in the visitor, as it won't be called on the while body
allow condition to use static variables: maintain a list of static variables used, and if they are mutable
2018-05-27 23:59:07 +02:00
Philipp Hansch
6eb07cc5b6
Fix ICE for issue 2594 2018-05-17 21:12:06 +02:00
Mateusz Mikuła
f0c823a85e Rustup to 2018-05-16 2018-05-17 11:21:15 +02:00
Philipp Hansch
26b48bbdfc
Rustup to 2018-05-13 2018-05-13 10:44:57 +02:00
Philipp Hansch
665cf96221
Rustup to 2018-05-11 2018-05-11 09:53:21 +02:00
Oliver Schneider
c6e35eae53
Check that we don't treat any type but a range type as a range 2018-05-08 17:16:01 +02:00
Michael Wright
1477f34858 Fixes compilation for rust nightly 2018-05-05
Closes #2725
2018-05-06 14:05:41 +02:00
Oliver Schneider
f786a36949
Rustup 2018-04-17 10:52:25 +02:00
Michael Wright
a9c8d1bd90 Fix compilation for nightly 2018-04-15
This only fixes compilation and the build. It's possible that the `author`
and `inspector` lints are broken but there are no failing tests.

Closes #2667
2018-04-15 05:01:43 +02:00
Stefano Probst
01faa906d2
Fix Markdown link syntax in lint doc
Currently this link is wrong rendered. See https://rust-lang-nursery.github.io/rust-clippy/v0.0.193/index.html#iter_next_loop
2018-04-14 11:35:52 +02:00
flip1995
cecfdeab19
Don't trigger while_immutable_condition for mutable fields of tuples/structs 2018-04-03 16:41:30 +02:00
Oliver Schneider
c1bbc173da
Address review comments 2018-03-29 13:41:53 +02:00
Oliver Schneider
d6344c47e3
Categorize all the lints! 2018-03-28 15:24:26 +02:00
flip1995
7d29075132
Skip the mutation in while body case for closures 2018-03-27 02:13:06 +02:00
flip1995
d458f22d89
Fix check of immutable condition in closure 2018-03-27 01:21:25 +02:00
Karim Snj
737247e50e while_immutable_condition: limit suggestion span to condition 2018-03-26 23:24:57 +02:00
Karim Snj
85bcaad412 while_immutable_condition: fix handling of self 2018-03-26 23:16:54 +02:00
Mateusz Mikuła
cfb9b982c5 Apply clippy suggestions
Signed-off-by: Mateusz Mikuła <mati865@gmail.com>
2018-03-16 10:54:49 +01:00
Oliver Schneider
f7b2578aea
Update to rustc master 2018-03-13 11:38:21 +01:00
Karim Snj
ae5354e6ef lint: while immutable condition: do not lint constants 2018-03-07 18:25:09 +01:00
Oliver Schneider
4cf02c7e1a
Merge pull request #2483 from kimsnj/infinite_loop
immutable while condition
2018-03-07 08:09:48 +01:00
Karim Snj
1ea84c80c1 lint: while immutable condition: refactor to use ExprUseVisitor 2018-03-05 22:42:32 +01:00
HMPerson1
3045f432c7
Fix #2496 2018-03-04 22:56:03 -05:00
Karim Snj
7d35fab304 lint: while loop: detect if no var from the condition is mutated 2018-03-02 00:01:08 +01:00
Karim Snj
37eca59438 lint: while immutable condition: refactor to use hir::Visitor 2018-03-01 22:00:43 +01:00
Karim Snj
5c1be4a4ba lint: immutable only vars in while condition 2018-02-25 18:25:31 +01:00
Michael Wright
daa39b3be1 Fix compilation
Fix the compilation broken by these two changes:
+ 2d56abfbeb (diff-7fceb7ede15b205bf5ad812c31d75384L1459)
+ ccf0d8399e (diff-64b696b0ef6ad44140e973801ed82b25L2771)
2018-01-27 15:03:17 +02:00
Oliver Schneider
0b0337d258
Fix #2247 2017-11-29 15:52:57 +01:00
Oliver Schneider
1b323b9f35
Don't lint mixed slice indexing and usize indexing in needless_range_loop 2017-11-07 15:32:52 +01:00
Oliver Schneider
652df0fb79
Differentiate between mutable iteration and immutable iteration in needless_range_loop 2017-11-07 14:41:54 +01:00
laurent
e2b9cf836a Fix merge issues. 2017-11-06 23:22:19 +00:00
laurent
af2c93eeb2 Clean the code a bit. 2017-11-05 15:45:23 +00:00
laurent
4fb1bb124e Make the dogfood test happy. 2017-11-05 15:17:28 +00:00
laurent
42f44d5c78 Cosmetic change. 2017-11-05 15:04:01 +00:00
laurent
7624736961 Bugfix. 2017-11-05 14:56:15 +00:00
laurent
bcdf57e220 Refactor the never-loop detection, fixes #1991. 2017-11-05 14:43:28 +00:00
topecongiro
7a06d312fd Cargo fmt 2017-11-05 04:55:56 +09:00
Lukas Stevens
0ae2ece91e Check for arrays with size > 32 2017-10-25 21:41:31 +02:00
Alex Burka
41840ae3c4 mechanically swap if_let_chain -> if_chain 2017-10-23 15:18:02 -04:00
Oliver Schneider
ebdefff88a
Something went through the cracks of our CI 2017-10-20 16:13:50 +02:00
Oliver Schneider
327d995bb6 Merge pull request #2147 from clippered/fix-manual-memcpy-on-overlapping-slices
Fix #2123 : check that the source and destination are different for m…
2017-10-20 09:27:15 +02:00
Manish Goregaokar
1f81dcbebd
Pass null borrow context to EUV 2017-10-19 09:27:58 -07:00
clippered
dfa4cb7ade Fix #2123 : check that the source and destination are different for manual memcpy 2017-10-18 07:06:01 +11:00
Oliver Schneider
58002b0e37 Merge pull request #2119 from camsteffen/never_loop
Another never_loop fix
2017-10-11 08:21:28 +02:00
Cameron Steffen
752900ca3b change expect message 2017-10-10 16:30:10 -05:00
Cameron Steffen
9ccb7108b5 fix never_loop 2017-10-08 17:26:39 -05:00
Cameron Steffen
533a50547f remove contains_continue functions 2017-10-08 17:24:32 -05:00
Andriy S. from cobalt
52bd7bb662 relax needless_range_loop so that it reports only direct indexing 2017-10-08 18:34:31 +03:00
Cameron Steffen
d92d5a8811 fix never_loop 2017-10-06 00:04:39 -05:00
Manish Goregaokar
0ca166277c Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27) 2017-09-28 07:11:34 -07:00
Manish Goregaokar
94c6f4a868 Pass dogfood 2017-09-25 18:39:50 -07:00
Laura Peskin
d7867ef8c1 add lint for mutable borrow; may have false positives. pushed for feedback 2017-09-25 02:00:21 -04:00
Laura Peskin
2fe968774a replace defids with nodeids for local variables 2017-09-25 01:44:47 -04:00
Laura Peskin
c326a779dd use def_id of function in check_for_mutation 2017-09-24 15:40:17 -04:00
Laura Peskin
9a17150a06 refactor, add spans to warnings, add tests 2017-09-24 15:40:17 -04:00
Manish Goregaokar
d0eff10a7c Update test, fix lint 2017-09-24 15:40:16 -04:00
Manish Goregaokar
27d5ff6c9c Rustup 2017-09-24 15:40:16 -04:00
Laura Peskin
74f4fd32e9 attempt to add check for mutation of range bound within loop; compiles but doesn't work as intended. pushed for feedback 2017-09-24 15:40:16 -04:00
Laura Peskin
319f12a4c4 implement lint for mutable range bound 2017-09-24 15:40:16 -04:00
Laura Peskin
b091fb9b24 add lint declaration and example that should trigger the lint 2017-09-24 15:40:16 -04:00
Oliver Schneider
2bb8efdb4d Merge pull request #2058 from rust-lang-nursery/ptr_arg-vs-clone
add suggestions for .clone() in ptr_arg fns
2017-09-17 15:37:21 +02:00
Marcus Klaas
48ed3c058f Extend MANUAL_MEMCPY lint so that it also detects manual clones between slices 2017-09-16 19:17:22 -04:00
Marcus Klaas
e461e3f915 Format loops.rs with latest stable rustfmt 2017-09-16 18:45:28 -04:00
Andre Bogus
72be166756 add suggestions for .clone() in ptr_arg fns 2017-09-16 09:10:26 +02:00
Seiichi Uchida
1f6801dd6a Add ExprLoop to contains_continue_expr() 2017-09-14 22:26:59 +09:00
Oliver Schneider
32a9394490
Rustup 2017-09-13 15:34:04 +02:00
Oliver Schneider
b127ad251f
Rustup 2017-09-12 14:38:59 +02:00
Tim Nielens
7489a84c6a while_let_loop doesn't take into account break-with-value #1948 2017-09-05 22:28:30 +02:00
Manish Goregaokar
7e9ba81297 for loops -> for-loops 2017-09-05 12:10:53 -07:00
Marcus Klaas
90f345df94
Add lint to detect manual slice copies 2017-09-05 12:56:26 +02:00
Oliver Schneider
e4524ac4de
Run nightly rustfmt 2017-09-05 12:39:27 +02:00
Oliver Schneider
009f5aaf83
Update to latest nightly 2017-09-04 16:10:36 +02:00
Manish Goregaokar
4807909152 Rustup to rustc 1.22.0-nightly (744dd6c1d 2017-09-02) (fixes #2013) 2017-09-03 13:55:45 -07:00
Oliver Schneider
f3ae929b2d Rustup 2017-08-15 11:10:49 +02:00
Oliver Schneider
b25b6b3355
Rustfmt 2017-08-14 09:43:26 +02:00
Andre Bogus
76ca4dca85 unify checks into single visitor, fix block walk 2017-08-04 07:48:43 +02:00
Andre Bogus
3b7f3dc8e7 WIP: Find binding or assignment within outer loop 2017-08-03 22:11:58 +02:00
Oliver Schneider
9967e9aacc Update to latest master 2017-07-31 12:37:38 +02:00
Oliver Schneider
68948a5654
Fix various needless_range_loop false positives 2017-07-16 19:34:38 +02:00