]> git.lizzy.rs Git - rust.git/commitdiff
Merge branch 'master' into patch-2
authorKagami Sascha Rosylight <saschanaz@outlook.com>
Tue, 15 Nov 2022 20:16:11 +0000 (21:16 +0100)
committerGitHub <noreply@github.com>
Tue, 15 Nov 2022 20:16:11 +0000 (21:16 +0100)
compiler/rustc_lint/src/let_underscore.rs
compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
compiler/rustc_lint_defs/src/builtin.rs
src/tools/lint-docs/src/lib.rs

index c8939256bbbf6856724beacad7a4760bd9ee3463..04d844d21dc38d9dc959218978a4ba1a13696211 100644 (file)
@@ -57,7 +57,7 @@
     /// of at end of scope, which is typically incorrect.
     ///
     /// ### Example
-    /// ```compile_fail
+    /// ```rust,compile_fail
     /// use std::sync::{Arc, Mutex};
     /// use std::thread;
     /// let data = Arc::new(Mutex::new(0));
index 7443d131c64dc315c8f278059fe488e498b54a0e..619582c0539b86dd0f3d04d6c09b4c557306f383 100644 (file)
     ///
     /// ### Example
     ///
-    /// ```
+    /// ```rust
+    /// trait Duh {}
+    ///
+    /// impl Duh for i32 {}
+    ///
     /// trait Trait {
-    ///     type Assoc: Send;
+    ///     type Assoc: Duh;
     /// }
     ///
     /// struct Struct;
     ///
-    /// impl Trait for Struct {
-    ///     type Assoc = i32;
+    /// impl<F: Duh> Trait for F {
+    ///     type Assoc = F;
     /// }
     ///
     /// fn test() -> impl Trait<Assoc = impl Sized> {
-    ///     Struct
+    ///     42
     /// }
     /// ```
     ///
index 389f3ccf72acf3ea1b8d22dd16e41290890045b7..b80facb1759efd502c86fe6dd5d75f6f7e5f543f 100644 (file)
     ///
     /// ### Example
     ///
-    /// ```
+    /// ```rust
     /// #[warn(unused_tuple_struct_fields)]
     /// struct S(i32, i32, i32);
     /// let s = S(1, 2, 3);
     ///
     /// ### Example
     ///
-    /// ```compile_fail
+    /// ```rust,compile_fail
     /// #[repr(packed)]
     /// pub struct Foo {
     ///     field1: u64,
     ///
     /// ### Example
     ///
-    /// ```compile_fail
+    /// ```rust,compile_fail
     /// # #![allow(unused)]
     /// enum E {
     ///     A,
     ///
     /// ### Example
     ///
-    /// ```
+    /// ```rust
     /// #![allow(test_unstable_lint)]
     /// ```
     ///
index 857feb7732536bdd6a4d0d70677859efc784cc28..3842a649c6f96a2070859ae13ac5a84a285730fc 100644 (file)
@@ -37,10 +37,8 @@ fn doc_contains(&self, text: &str) -> bool {
     }
 
     fn is_ignored(&self) -> bool {
-        self.doc
-            .iter()
-            .filter(|line| line.starts_with("```rust"))
-            .all(|line| line.contains(",ignore"))
+        let blocks: Vec<_> = self.doc.iter().filter(|line| line.starts_with("```rust")).collect();
+        !blocks.is_empty() && blocks.iter().all(|line| line.contains(",ignore"))
     }
 
     /// Checks the doc style of the lint.