Commit Graph

871 Commits

Author SHA1 Message Date
Oliver Schneider 902c7d832b fix cc computation in the presence of diverging calls
CFG treats diverging calls as its completely own path out of the function.
While this makes sense, it should also mean that a panic should increase the cyclomatic
complexity. Instead it decreases it.

Minimal example:

```rust
if a {
    b
} else {
    panic!("cake");
}
d
```

creates the following graph

```dot
digraph G {
  "if a" -> "b"
  "if a" -> "panic!(\"cake\")"
  "b" -> c
}
```

which has a CC of 1 (3 - 4 + 2). A CC of 1 means there is one path through the program.
Obviously that is wrong. There are two paths. One returning normally, and one panicking.
2015-12-14 14:29:20 +01:00
llogiq c0bccc9567 more doc comments 2015-12-14 13:32:07 +01:00
Manish Goregaokar dc3a3e79db Merge pull request #500 from oli-obk/patch-1
compiletest_rs needs to be at least 0.0.11
2015-12-14 17:51:25 +05:30
Oliver Schneider ecb97866b6 compiletest_rs needs to be at least 0.0.11
otherwise tests using `SUGGESTION` will fail (see `compile-fail/eta.rs`)
2015-12-14 11:28:22 +01:00
llogiq d7292fe235 more docs 2015-12-14 08:03:01 +01:00
Manish Goregaokar f2b977907c Merge branch 'more_wiki' 2015-12-13 21:58:18 +05:30
Devon Hollowood 6960bf2ebc Make ExprField follow single-underscore rules 2015-12-12 21:59:25 -08:00
Devon Hollowood b24e3aeea0 Add wiki docs, in line with #492 2015-12-12 21:56:05 -08:00
Devon Hollowood 92fba6bd2c Make clippy tests compatible with new lint 2015-12-12 21:39:10 -08:00
Devon Hollowood aeb5a0e60c Reduce false positives
Add macro checking, and only lint for single leading underscores
2015-12-12 21:39:10 -08:00
Devon Hollowood 6091112698 Update tests 2015-12-12 21:39:10 -08:00
Devon Hollowood 43b96d59ad Run update_lints.py 2015-12-12 21:39:10 -08:00
Devon Hollowood 9de308ee15 Add used_underscore_binding lint 2015-12-12 21:39:10 -08:00
Devon Hollowood 6482840bc5 Add tests 2015-12-12 21:39:10 -08:00
Manish Goregaokar 4ae43b10f0 Add wiki note for escape analysis 2015-12-13 09:08:58 +05:30
Manish Goregaokar 76049a7cd0 Merge pull request #497 from cesarb/ringbuf
Mention VecDeque in linkedlist lint
2015-12-12 19:22:55 -05:00
Cesar Eduardo Barros 8e59be318c Mention VecDeque in linkedlist lint
I couldn't find anything named RingBuf in the standard library. Some
search revealed that it had been renamed to VecDeque before the first
stable Rust release.
2015-12-12 20:05:06 -02:00
Manish Goregaokar 6aa656a910 Merge pull request #492 from Manishearth/wiki
added wiki comments + wiki-generating python script
2015-12-11 09:20:19 -05:00
Seo Sanghyeon 974ab43453 Use suggestion for needless_return 2015-12-11 16:28:05 +09:00
llogiq 5bbc1427fd added wiki comments + wiki-generating python script 2015-12-11 01:22:27 +01:00
llogiq 3e7677ff31 Merge pull request #490 from Manishearth/fx-lifetime-fp
Check for unused lifetimes in bounds (fixes #489)
2015-12-10 18:14:24 +01:00
Manish Goregaokar b9546599e3 Check for unused lifetimes in bounds (fixes #489) 2015-12-10 12:02:59 -05:00
Manish Goregaokar b865e30b49 Upgrade rust to rustc 1.6.0-nightly (462ec0576 2015-12-09) 2015-12-09 15:56:49 -05:00
llogiq 2fbe762a99 Merge pull request #485 from sanxiyn/suggestion
Use suggestion for redundant_closure
2015-12-08 23:18:25 +01:00
Seo Sanghyeon 213c15cd66 Add span_lint_and_then and use it 2015-12-09 02:46:14 +09:00
Seo Sanghyeon 35b5c3efdd Use suggestion for redundant_closure 2015-12-08 15:03:01 +09:00
Andre Bogus 98c4dc185c updated lints 2015-12-08 06:32:55 +01:00
llogiq 3260b501a2 Merge pull request #483 from Manishearth/bored
Add lint for unused lifetimes (fixes #459)
2015-12-07 21:47:10 +01:00
Manish Goregaokar e8686a3ecd Merge branch 'pr-482' 2015-12-07 07:23:52 -05:00
Guillaume Gomez 72117836f1 Add check on redundant _ bindings in structs 2015-12-07 13:16:59 +01:00
Manish Goregaokar c7b87a06d2 Add lint for unused lifetimes (fixes #459) 2015-12-07 06:55:14 -05:00
Manish Goregaokar c4e9982dd7 Merge pull request #481 from fhartwig/lifetime-with-alias
Make unneeded_lifetimes lint work properly with type aliases
2015-12-06 09:08:40 +05:30
Florian Hartwig ac39dc290b Remove obsolete workaround 2015-12-06 02:05:32 +01:00
Florian Hartwig 62db392730 Make lifetimes lint work with type aliases and non-locally-defined structs 2015-12-06 02:04:13 +01:00
Manish Goregaokar b660bfa09e Merge pull request #480 from mrmonday/nightly-fixes
Fix clippy with latest Rust nightly.
2015-12-05 18:54:42 +05:30
Robert Clipsham 978c41584f Fix clippy with latest Rust nightly. 2015-12-05 12:33:58 +00:00
Manish Goregaokar dc414e6c02 Make panic in CC silencable (partial #478) 2015-12-05 14:23:00 +05:30
llogiq 5827240e17 Merge pull request #477 from Manishearth/escape
Rudimentary escape analysis for Box<T>
2015-12-04 19:29:13 +01:00
Manish Goregaokar 18e81c1b59 Rudimentary escape analysis for Box<T> 2015-12-04 20:23:14 +05:30
llogiq e90acaf596 Merge pull request #460 from oli-obk/cyclomatic_complexity
Cyclomatic complexity
2015-12-03 16:52:53 +01:00
Oliver Schneider 04524c549e improve cc of function 2015-12-03 16:41:55 +01:00
Oliver Schneider 3d1b7e1957 high-speed-dogfood 2015-12-03 16:41:55 +01:00
Oliver Schneider 617c820e6b compute cyclomatic complexity (adjusted to not punish Rust's `match`) 2015-12-03 16:41:55 +01:00
llogiq 41bad83360 Merge pull request #475 from sanxiyn/unused-qualification
Remove unused qualifications
2015-12-02 15:38:19 +01:00
Seo Sanghyeon 26f539eaa3 Remove unused qualifications 2015-12-02 23:25:12 +09:00
Manish Goregaokar b45745e905 bump 27 2015-11-30 23:17:14 +05:30
Manish Goregaokar ba59ed05e3 Rust upgrade to rustc 1.6.0-nightly (52d95e644 2015-11-30) 2015-11-30 23:16:28 +05:30
Manish Goregaokar 2ce2bc3345 Bump to 26 2015-11-30 15:52:17 +05:30
Manish Goregaokar f34e919e60 Merge branch 'pr-474' 2015-11-30 15:51:59 +05:30
Hobofan 7d583dab80 fix for latest nightly
Fixes breakage introduced by rust-lang/rust#30043
2015-11-27 14:50:23 +01:00