Skip to content

Commit a7f4505

Browse files
authored
Merge pull request #1601 from ensch/master
Fix for rustc 1.17.0-nightly (b1e3176 2017-03-03)
2 parents c2d9d46 + 1f8b212 commit a7f4505

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clippy_lints/src/cyclomatic_complexity.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ impl LintPass for CyclomaticComplexity {
4141
}
4242

4343
impl CyclomaticComplexity {
44-
fn check<'a, 'tcx: 'a>(&mut self, cx: &'a LateContext<'a, 'tcx>, expr: &'tcx Expr, span: Span) {
44+
fn check<'a, 'tcx: 'a>(&mut self, cx: &'a LateContext<'a, 'tcx>, body: &'tcx Body, span: Span) {
4545
if in_macro(cx, span) {
4646
return;
4747
}
4848

49-
let cfg = CFG::new(cx.tcx, expr);
49+
let cfg = CFG::new(cx.tcx, body);
50+
let expr = &body.value;
5051
let n = cfg.graph.len_nodes() as u64;
5152
let e = cfg.graph.len_edges() as u64;
5253
if e + 2 < n {
@@ -101,7 +102,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CyclomaticComplexity {
101102
) {
102103
let def_id = cx.tcx.hir.local_def_id(node_id);
103104
if !cx.tcx.has_attr(def_id, "test") {
104-
self.check(cx, &body.value, span);
105+
self.check(cx, body, span);
105106
}
106107
}
107108

0 commit comments

Comments
 (0)