Skip to content

Commit af25137

Browse files
authored
Rollup merge of rust-lang#103484 - saschanaz:patch-2, r=ehuss
Add `rust` to `let_underscore_lock` example Currently https://doc.rust-lang.org/beta/rustc/lints/listing/deny-by-default.html#let-underscore-lock has no colored grammar and raw `{{produces}}` command is exposed.
2 parents 9cb5855 + 0a528b1 commit af25137

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

Diff for: compiler/rustc_lint/src/let_underscore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare_lint! {
5757
/// of at end of scope, which is typically incorrect.
5858
///
5959
/// ### Example
60-
/// ```compile_fail
60+
/// ```rust,compile_fail
6161
/// use std::sync::{Arc, Mutex};
6262
/// use std::thread;
6363
/// let data = Arc::new(Mutex::new(0));

Diff for: compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,23 @@ declare_lint! {
2626
///
2727
/// ### Example
2828
///
29-
/// ```
29+
/// ```rust
30+
/// trait Duh {}
31+
///
32+
/// impl Duh for i32 {}
33+
///
3034
/// trait Trait {
31-
/// type Assoc: Send;
35+
/// type Assoc: Duh;
3236
/// }
3337
///
3438
/// struct Struct;
3539
///
36-
/// impl Trait for Struct {
37-
/// type Assoc = i32;
40+
/// impl<F: Duh> Trait for F {
41+
/// type Assoc = F;
3842
/// }
3943
///
4044
/// fn test() -> impl Trait<Assoc = impl Sized> {
41-
/// Struct
45+
/// 42
4246
/// }
4347
/// ```
4448
///

Diff for: compiler/rustc_lint_defs/src/builtin.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ declare_lint! {
605605
///
606606
/// ### Example
607607
///
608-
/// ```
608+
/// ```rust
609609
/// #[warn(unused_tuple_struct_fields)]
610610
/// struct S(i32, i32, i32);
611611
/// let s = S(1, 2, 3);
@@ -1154,7 +1154,7 @@ declare_lint! {
11541154
///
11551155
/// ### Example
11561156
///
1157-
/// ```compile_fail
1157+
/// ```rust,compile_fail
11581158
/// #[repr(packed)]
11591159
/// pub struct Foo {
11601160
/// field1: u64,
@@ -2548,7 +2548,7 @@ declare_lint! {
25482548
///
25492549
/// ### Example
25502550
///
2551-
/// ```compile_fail
2551+
/// ```rust,compile_fail
25522552
/// # #![allow(unused)]
25532553
/// enum E {
25542554
/// A,
@@ -3918,7 +3918,7 @@ declare_lint! {
39183918
///
39193919
/// ### Example
39203920
///
3921-
/// ```
3921+
/// ```rust
39223922
/// #![allow(test_unstable_lint)]
39233923
/// ```
39243924
///

Diff for: src/tools/lint-docs/src/lib.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ impl Lint {
3737
}
3838

3939
fn is_ignored(&self) -> bool {
40-
self.doc
41-
.iter()
42-
.filter(|line| line.starts_with("```rust"))
43-
.all(|line| line.contains(",ignore"))
40+
let blocks: Vec<_> = self.doc.iter().filter(|line| line.starts_with("```rust")).collect();
41+
!blocks.is_empty() && blocks.iter().all(|line| line.contains(",ignore"))
4442
}
4543

4644
/// Checks the doc style of the lint.

0 commit comments

Comments
 (0)