]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/minmax.rs
Auto merge of #3596 - xfix:remove-crate-from-paths, r=flip1995
[rust.git] / clippy_lints / src / minmax.rs
index bc573841cc80d0651c6a3ff0c670bb56eba1feeb..087aa94a7ecfad42ba9ed5d8548fa8ab747613f6 100644 (file)
@@ -1,8 +1,17 @@
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use crate::consts::{constant_simple, Constant};
 use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
 use rustc::hir::*;
-use rustc::lint::*;
-use rustc::{declare_lint, lint_array};
+use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
+use rustc::{declare_tool_lint, lint_array};
 use std::cmp::Ordering;
 
 /// **What it does:** Checks for expressions where `std::cmp::min` and `max` are
@@ -25,7 +34,6 @@
     "`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant"
 }
 
-#[allow(missing_copy_implementations)]
 pub struct MinMaxPass;
 
 impl LintPass for MinMaxPass {
@@ -43,7 +51,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
                 }
                 match (
                     outer_max,
-                    Constant::partial_cmp(cx.tcx, &cx.tables.expr_ty(ie).sty, &outer_c, &inner_c),
+                    Constant::partial_cmp(cx.tcx, cx.tables.expr_ty(ie), &outer_c, &inner_c),
                 ) {
                     (_, None) | (MinMax::Max, Some(Ordering::Less)) | (MinMax::Min, Some(Ordering::Greater)) => (),
                     _ => {