8000 Rustup to rustc 1.36.0-nightly (acc7e652f 2019-05-10) by Manishearth · Pull Request #4080 · rust-lang/rust-clippy · GitHub
[go: up one dir, main page]

Skip to content

Rustup to rustc 1.36.0-nightly (acc7e652f 2019-05-10) #4080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 11, 2019
Prev Previous commit
Next Next commit
Fix needless_bool.rs
  • Loading branch information
Manishearth committed May 11, 2019
commit da8b56d99ab50f628d94210225507d87a4cb0251
6 changes: 3 additions & 3 deletions clippy_lints/src/needless_bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This lint is **warn** by default

use crate::utils::sugg::Sugg;
use crate::utils::{in_macro, span_lint, span_lint_and_sugg};
use crate::utils::{higher, in_macro, span_lint, span_lint_and_sugg};
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint_pass, declare_tool_lint};
Expand Down Expand Up @@ -59,7 +59,7 @@ declare_lint_pass!(NeedlessBool => [NEEDLESS_BOOL]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
use self::Expression::*;
if let ExprKind::If(ref pred, ref then_block, Some(ref else_expr)) = e.node {
if let Some((ref pred, ref then_block, Some(ref else_expr))) = higher::if_block(&e) {
let reduce = |ret, not| {
let mut applicability = Applicability::MachineApplicable;
let snip = Sugg::hir_with_applicability(cx, pred, "<predicate>", &mut applicability);
Expand Down Expand Up @@ -119,7 +119,7 @@ fn parent_node_is_if_expr<'a, 'b>(expr: &Expr, cx: &LateContext<'a, 'b>) -> bool
let parent_node = cx.tcx.hir().get_by_hir_id(parent_id);

if let rustc::hir::Node::Expr(e) = parent_node {
if let ExprKind::If(_, _, _) = e.node {
if higher::if_block(&e).is_some() {
return true;
}
}
Expand Down
0