about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-04-15 15:15:31 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2020-04-15 23:38:48 +0200
commit139c64625173edab849acd9fbcea9739bb2bb802 (patch)
tree0c7e08f692321138c8cb0c7c12151255ea13b3d6 /src
parent835428c35d785733e72bfbf32fc2f8fff3e50e63 (diff)
downloadrust-139c64625173edab849acd9fbcea9739bb2bb802.tar.gz
rust-139c64625173edab849acd9fbcea9739bb2bb802.zip
Fix clippy warnings
clippy::{filter_next,single_char_pattern,unit_arg,identity_conversion,nonminimal_bool}
Diffstat (limited to 'src')
-rw-r--r--src/liballoc/vec.rs12
-rw-r--r--src/librustc_infer/infer/outlives/verify.rs1
-rw-r--r--src/librustc_mir/borrow_check/region_infer/mod.rs2
-rw-r--r--src/librustc_mir/interpret/place.rs2
-rw-r--r--src/librustc_trait_selection/traits/error_reporting/mod.rs4
-rw-r--r--src/librustdoc/docfs.rs4
6 files changed, 12 insertions, 13 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 7ef281ff208..b4a9da84787 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -971,7 +971,7 @@ impl<T> Vec<T> {
         }
 
         let len = self.len();
-        if !(index < len) {
+        if index >= len {
             assert_failed(index, len);
         }
         unsafe {
@@ -1010,7 +1010,7 @@ impl<T> Vec<T> {
         }
 
         let len = self.len();
-        if !(index <= len) {
+        if index > len {
             assert_failed(index, len);
         }
 
@@ -1058,7 +1058,7 @@ impl<T> Vec<T> {
         }
 
         let len = self.len();
-        if !(index < len) {
+        if index >= len {
             assert_failed(index, len);
         }
         unsafe {
@@ -1331,10 +1331,10 @@ impl<T> Vec<T> {
             panic!("end drain index (is {}) should be <= len (is {})", end, len);
         }
 
-        if !(start <= end) {
+        if start > end {
             start_assert_failed(start, end);
         }
-        if !(end <= len) {
+        if end > len {
             end_assert_failed(end, len);
         }
 
@@ -1432,7 +1432,7 @@ impl<T> Vec<T> {
             panic!("`at` split index (is {}) should be <= len (is {})", at, len);
         }
 
-        if !(at <= self.len()) {
+        if at > self.len() {
             assert_failed(at, self.len());
         }
 
diff --git a/src/librustc_infer/infer/outlives/verify.rs b/src/librustc_infer/infer/outlives/verify.rs
index 5b6db324e6c..4adf314c3d4 100644
--- a/src/librustc_infer/infer/outlives/verify.rs
+++ b/src/librustc_infer/infer/outlives/verify.rs
@@ -297,7 +297,6 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
         self.collect_outlives_from_predicate_list(
             move |ty| ty == identity_proj,
             traits::elaborate_predicates(tcx, trait_predicates)
-                .into_iter()
                 .map(|o| o.predicate)
                 .collect::<Vec<_>>(),
         )
diff --git a/src/librustc_mir/borrow_check/region_infer/mod.rs b/src/librustc_mir/borrow_check/region_infer/mod.rs
index 40012116633..7987b77997d 100644
--- a/src/librustc_mir/borrow_check/region_infer/mod.rs
+++ b/src/librustc_mir/borrow_check/region_infer/mod.rs
@@ -495,7 +495,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
         // to store those. Otherwise, we'll pass in `None` to the
         // functions below, which will trigger them to report errors
         // eagerly.
-        let mut outlives_requirements = infcx.tcx.is_closure(mir_def_id).then(|| vec![]);
+        let mut outlives_requirements = infcx.tcx.is_closure(mir_def_id).then(Vec::new);
 
         self.check_type_tests(infcx, body, outlives_requirements.as_mut(), &mut errors_buffer);
 
diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs
index 9ac4b3551fc..0fd930090d5 100644
--- a/src/librustc_mir/interpret/place.rs
+++ b/src/librustc_mir/interpret/place.rs
@@ -549,7 +549,7 @@ where
                 let n = base.len(self)?;
                 if n < u64::from(min_length) {
                     // This can only be reached in ConstProp and non-rustc-MIR.
-                    throw_ub!(BoundsCheckFailed { len: min_length.into(), index: n.into() });
+                    throw_ub!(BoundsCheckFailed { len: min_length.into(), index: n });
                 }
 
                 let index = if from_end {
diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs
index fef7adf0224..0f527419d03 100644
--- a/src/librustc_trait_selection/traits/error_reporting/mod.rs
+++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs
@@ -1388,7 +1388,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
                     (self.tcx.sess.source_map().span_to_snippet(span), &obligation.cause.code)
                 {
                     let generics = self.tcx.generics_of(*def_id);
-                    if generics.params.iter().filter(|p| p.name.as_str() != "Self").next().is_some()
+                    if generics.params.iter().any(|p| p.name.as_str() != "Self")
                         && !snippet.ends_with('>')
                     {
                         // FIXME: To avoid spurious suggestions in functions where type arguments
@@ -1817,7 +1817,7 @@ pub fn suggest_constraining_type_param(
         // Account for `fn foo<T>(t: T) where T: Foo,` so we don't suggest two trailing commas.
         let mut trailing_comma = false;
         if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(where_clause_span) {
-            trailing_comma = snippet.ends_with(",");
+            trailing_comma = snippet.ends_with(',');
         }
         let where_clause_span = if trailing_comma {
             let hi = where_clause_span.hi();
diff --git a/src/librustdoc/docfs.rs b/src/librustdoc/docfs.rs
index 9c9a00295c3..7ebb200abfe 100644
--- a/src/librustdoc/docfs.rs
+++ b/src/librustdoc/docfs.rs
@@ -16,12 +16,12 @@ use std::sync::mpsc::{channel, Receiver, Sender};
 use std::sync::Arc;
 
 macro_rules! try_err {
-    ($e:expr, $file:expr) => {{
+    ($e:expr, $file:expr) => {
         match $e {
             Ok(e) => e,
             Err(e) => return Err(E::new(e, $file)),
         }
-    }};
+    };
 }
 
 pub trait PathError {