Skip to content
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

Add rust to let_underscore_lock example #103484

Merged
merged 6 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/let_underscore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ declare_lint! {
/// 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));
Expand Down
14 changes: 9 additions & 5 deletions compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,23 @@ declare_lint! {
///
/// ### 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to copypaste from the tests since the example didn't emit the warning. @compiler-errors

/// }
/// ```
///
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ declare_lint! {
///
/// ### Example
///
/// ```
/// ```rust
/// #[warn(unused_tuple_struct_fields)]
/// struct S(i32, i32, i32);
/// let s = S(1, 2, 3);
Expand Down Expand Up @@ -1154,7 +1154,7 @@ declare_lint! {
///
/// ### Example
///
/// ```compile_fail
/// ```rust,compile_fail
/// #[repr(packed)]
/// pub struct Foo {
/// field1: u64,
Expand Down Expand Up @@ -2548,7 +2548,7 @@ declare_lint! {
///
/// ### Example
///
/// ```compile_fail
/// ```rust,compile_fail
/// # #![allow(unused)]
/// enum E {
/// A,
Expand Down Expand Up @@ -3918,7 +3918,7 @@ declare_lint! {
///
/// ### Example
///
/// ```
/// ```rust
/// #![allow(test_unstable_lint)]
/// ```
///
Expand Down
6 changes: 2 additions & 4 deletions src/tools/lint-docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ impl Lint {
}

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.
Expand Down