Skip to content

Commit bca08a6

Browse files
committed
Auto merge of #4589 - mikerite:booleans-refactor-20190925, r=phansch
Refactor `booleans` Remove unused output from `suggest(..)` changelog: none
2 parents f7d7456 + 8b9415c commit bca08a6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clippy_lints/src/booleans.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ struct SuggestContext<'a, 'tcx, 'v> {
156156
terminals: &'v [&'v Expr],
157157
cx: &'a LateContext<'a, 'tcx>,
158158
output: String,
159-
simplified: bool,
160159
}
161160

162161
impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
@@ -179,7 +178,6 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
179178
Term(n) => {
180179
let terminal = self.terminals[n as usize];
181180
if let Some(str) = simplify_not(self.cx, terminal) {
182-
self.simplified = true;
183181
self.output.push_str(&str)
184182
} else {
185183
self.output.push('!');
@@ -264,16 +262,14 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<String> {
264262
}
265263
}
266264

267-
// The boolean part of the return indicates whether some simplifications have been applied.
268-
fn suggest(cx: &LateContext<'_, '_>, suggestion: &Bool, terminals: &[&Expr]) -> (String, bool) {
265+
fn suggest(cx: &LateContext<'_, '_>, suggestion: &Bool, terminals: &[&Expr]) -> String {
269266
let mut suggest_context = SuggestContext {
270267
terminals,
271268
cx,
272269
output: String::new(),
273-
simplified: false,
274270
};
275271
suggest_context.recurse(suggestion);
276-
(suggest_context.output, suggest_context.simplified)
272+
suggest_context.output
277273
}
278274

279275
fn simple_negate(b: Bool) -> Bool {
@@ -383,7 +379,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
383379
db.span_suggestion(
384380
e.span,
385381
"it would look like the following",
386-
suggest(self.cx, suggestion, &h2q.terminals).0,
382+
suggest(self.cx, suggestion, &h2q.terminals),
387383
// nonminimal_bool can produce minimal but
388384
// not human readable expressions (#3141)
389385
Applicability::Unspecified,
@@ -428,7 +424,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
428424
nonminimal_bool_lint(
429425
improvements
430426
.into_iter()
431-
.map(|suggestion| suggest(self.cx, suggestion, &h2q.terminals).0)
427+
.map(|suggestion| suggest(self.cx, suggestion, &h2q.terminals))
432428
.collect(),
433429
);
434430
}

0 commit comments

Comments
 (0)