Skip to content

Commit

Permalink
Auto merge of #11699 - Alexendoo:no-run-doctests, r=llogiq
Browse files Browse the repository at this point in the history
Set doc-tests to `no_run`

This excludes `should_panic` tests, those are still run to ensure they panic. Most of our other doc snippets don't gain much from being run though so this frees up a nice bit of CI time

It also fixes the occasional issue such as `foo.txt`s being created https://github.com/rust-lang/rust-clippy/blob/f942470ca774b9648bac042f5d4c4ec74b81b61a/clippy_lints/src/permissions_set_readonly_false.rs#L19

changelog: none
  • Loading branch information
bors committed Oct 23, 2023
2 parents 9f5de66 + 7347c18 commit 033c763
Show file tree
Hide file tree
Showing 233 changed files with 991 additions and 991 deletions.
4 changes: 2 additions & 2 deletions book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,15 +774,15 @@ Additional dotfiles (files or directories starting with a dot) to allow

## `enforce-iter-loop-reborrow`
#### Example
```
```no_run
let mut vec = vec![1, 2, 3];
let rmvec = &mut vec;
for _ in rmvec.iter() {}
for _ in rmvec.iter_mut() {}
```

Use instead:
```
```no_run
let mut vec = vec![1, 2, 3];
let rmvec = &mut vec;
for _ in &*rmvec {}
Expand Down
4 changes: 2 additions & 2 deletions clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ fn get_lint_declaration(name_upper: &str, category: &str) -> String {
/// ### Why is this bad?
///
/// ### Example
/// ```rust
/// ```no_run
/// // example code where clippy issues a warning
/// ```
/// Use instead:
/// ```rust
/// ```no_run
/// // example code which does not raise clippy warning
/// ```
#[clippy::version = "{}"]
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/absolute_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ declare_clippy_lint! {
/// using absolute paths is the proper way of referencing items in one.
///
/// ### Example
/// ```rust
/// ```no_run
/// let x = std::f64::consts::PI;
/// ```
/// Use any of the below instead, or anything else:
/// ```rust
/// ```no_run
/// use std::f64;
/// use std::f64::consts;
/// use std::f64::consts::PI;
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/almost_complete_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ declare_clippy_lint! {
/// This (`'a'..'z'`) is almost certainly a typo meant to include all letters.
///
/// ### Example
/// ```rust
/// ```no_run
/// let _ = 'a'..'z';
/// ```
/// Use instead:
/// ```rust
/// ```no_run
/// let _ = 'a'..='z';
/// ```
#[clippy::version = "1.68.0"]
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ declare_clippy_lint! {
/// issue](https://github.com/rust-lang/rust/issues).
///
/// ### Example
/// ```rust
/// ```no_run
/// let x = 3.14;
/// let y = 1_f64 / x;
/// ```
/// Use instead:
/// ```rust
/// ```no_run
/// let x = std::f32::consts::PI;
/// let y = std::f64::consts::FRAC_1_PI;
/// ```
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/arc_with_non_send_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare_clippy_lint! {
/// either `T` should be made `Send + Sync` or an `Rc` should be used instead of an `Arc`
///
/// ### Example
/// ```rust
/// ```no_run
/// # use std::cell::RefCell;
/// # use std::sync::Arc;
///
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/async_yields_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare_clippy_lint! {
/// An await is likely missing.
///
/// ### Example
/// ```rust
/// ```no_run
/// async fn foo() {}
///
/// fn bar() {
Expand All @@ -26,7 +26,7 @@ declare_clippy_lint! {
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// async fn foo() {}
///
/// fn bar() {
Expand Down
42 changes: 21 additions & 21 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ declare_clippy_lint! {
/// a valid semver. Failing that, the contained information is useless.
///
/// ### Example
/// ```rust
/// ```no_run
/// #[deprecated(since = "forever")]
/// fn something_else() { /* ... */ }
/// ```
Expand All @@ -156,14 +156,14 @@ declare_clippy_lint! {
/// currently works for basic cases but is not perfect.
///
/// ### Example
/// ```rust
/// ```no_run
/// #[allow(dead_code)]
///
/// fn not_quite_good_code() { }
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// // Good (as inner attribute)
/// #![allow(dead_code)]
///
Expand Down Expand Up @@ -198,25 +198,25 @@ declare_clippy_lint! {
/// Does not detect empty lines after doc attributes (e.g. `#[doc = ""]`).
///
/// ### Example
/// ```rust
/// ```no_run
/// /// Some doc comment with a blank line after it.
///
/// fn not_quite_good_code() { }
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// /// Good (no blank line)
/// fn this_is_fine() { }
/// ```
///
/// ```rust
/// ```no_run
/// // Good (convert to a regular comment)
///
/// fn this_is_fine_too() { }
/// ```
///
/// ```rust
/// ```no_run
/// //! Good (convert to a comment on an inner attribute)
///
/// fn this_is_fine_as_well() { }
Expand All @@ -236,12 +236,12 @@ declare_clippy_lint! {
/// These lints should only be enabled on a lint-by-lint basis and with careful consideration.
///
/// ### Example
/// ```rust
/// ```no_run
/// #![deny(clippy::restriction)]
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// #![deny(clippy::as_conversions)]
/// ```
#[clippy::version = "1.47.0"]
Expand All @@ -265,13 +265,13 @@ declare_clippy_lint! {
/// [#3123](https://github.com/rust-lang/rust-clippy/pull/3123#issuecomment-422321765)
///
/// ### Example
/// ```rust
/// ```no_run
/// #[cfg_attr(rustfmt, rustfmt_skip)]
/// fn main() { }
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// #[rustfmt::skip]
/// fn main() { }
/// ```
Expand All @@ -290,13 +290,13 @@ declare_clippy_lint! {
/// by the conditional compilation engine.
///
/// ### Example
/// ```rust
/// ```no_run
/// #[cfg(linux)]
/// fn conditional() { }
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// # mod hidden {
/// #[cfg(target_os = "linux")]
/// fn conditional() { }
Expand Down Expand Up @@ -325,14 +325,14 @@ declare_clippy_lint! {
/// ensure that others understand the reasoning
///
/// ### Example
/// ```rust
/// ```no_run
/// #![feature(lint_reasons)]
///
/// #![allow(clippy::some_lint)]
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// #![feature(lint_reasons)]
///
/// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]
Expand All @@ -352,7 +352,7 @@ declare_clippy_lint! {
/// panicking with the expected message, and not another unrelated panic.
///
/// ### Example
/// ```rust
/// ```no_run
/// fn random() -> i32 { 0 }
///
/// #[should_panic]
Expand All @@ -363,7 +363,7 @@ declare_clippy_lint! {
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// fn random() -> i32 { 0 }
///
/// #[should_panic = "attempt to divide by zero"]
Expand All @@ -386,13 +386,13 @@ declare_clippy_lint! {
/// If there is only one condition, no need to wrap it into `any` or `all` combinators.
///
/// ### Example
/// ```rust
/// ```no_run
/// #[cfg(any(unix))]
/// pub struct Bar;
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// #[cfg(unix)]
/// pub struct Bar;
/// ```
Expand All @@ -412,13 +412,13 @@ declare_clippy_lint! {
/// may cause conditional compilation not work quitely.
///
/// ### Example
/// ```rust
/// ```no_run
/// #[cfg(features = "some-feature")]
/// fn conditional() { }
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// #[cfg(feature = "some-feature")]
/// fn conditional() { }
/// ```
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/await_holding_invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare_clippy_lint! {
/// to wrap the `.lock()` call in a block instead of explicitly dropping the guard.
///
/// ### Example
/// ```rust
/// ```no_run
/// # use std::sync::Mutex;
/// # async fn baz() {}
/// async fn foo(x: &Mutex<u32>) {
Expand All @@ -47,7 +47,7 @@ declare_clippy_lint! {
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// # use std::sync::Mutex;
/// # async fn baz() {}
/// async fn foo(x: &Mutex<u32>) {
Expand Down Expand Up @@ -87,7 +87,7 @@ declare_clippy_lint! {
/// to wrap the `.borrow[_mut]()` call in a block instead of explicitly dropping the ref.
///
/// ### Example
/// ```rust
/// ```no_run
/// # use std::cell::RefCell;
/// # async fn baz() {}
/// async fn foo(x: &RefCell<u32>) {
Expand All @@ -105,7 +105,7 @@ declare_clippy_lint! {
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// # use std::cell::RefCell;
/// # async fn baz() {}
/// async fn foo(x: &RefCell<u32>) {
Expand Down Expand Up @@ -151,7 +151,7 @@ declare_clippy_lint! {
/// ]
/// ```
///
/// ```rust
/// ```no_run
/// # async fn baz() {}
/// struct CustomLockType;
/// struct OtherCustomLockType;
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/blocks_in_if_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ declare_clippy_lint! {
/// Style, using blocks in the condition makes it hard to read.
///
/// ### Examples
/// ```rust
/// ```no_run
/// # fn somefunc() -> bool { true };
/// if { true } { /* ... */ }
///
/// if { let x = somefunc(); x } { /* ... */ }
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// # fn somefunc() -> bool { true };
/// if true { /* ... */ }
///
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/bool_assert_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ declare_clippy_lint! {
/// It is shorter to use the equivalent.
///
/// ### Example
/// ```rust
/// ```no_run
/// assert_eq!("a".is_empty(), false);
/// assert_ne!("a".is_empty(), true);
/// ```
///
/// Use instead:
/// ```rust
/// ```no_run
/// assert!(!"a".is_empty());
/// ```
#[clippy::version = "1.53.0"]
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/bool_to_int_with_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare_clippy_lint! {
/// See https://doc.rust-lang.org/std/primitive.bool.html#impl-From%3Cbool%3E
///
/// ### Example
/// ```rust
/// ```no_run
/// # let condition = false;
/// if condition {
/// 1_i64
Expand All @@ -30,12 +30,12 @@ declare_clippy_lint! {
/// };
/// ```
/// Use instead:
/// ```rust
/// ```no_run
/// # let condition = false;
/// i64::from(condition);
/// ```
/// or
/// ```rust
/// ```no_run
/// # let condition = false;
/// condition as i64;
/// ```
Expand Down
Loading

0 comments on commit 033c763

Please sign in to comment.