Skip to content

Commit 7347c18

Browse files
committed
Set existing doc-tests to no_run
1 parent 56ece10 commit 7347c18

File tree

232 files changed

+989
-989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+989
-989
lines changed

book/src/lint_configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,15 +774,15 @@ Additional dotfiles (files or directories starting with a dot) to allow
774774

775775
## `enforce-iter-loop-reborrow`
776776
#### Example
777-
```
777+
```no_run
778778
let mut vec = vec![1, 2, 3];
779779
let rmvec = &mut vec;
780780
for _ in rmvec.iter() {}
781781
for _ in rmvec.iter_mut() {}
782782
```
783783

784784
Use instead:
785-
```
785+
```no_run
786786
let mut vec = vec![1, 2, 3];
787787
let rmvec = &mut vec;
788788
for _ in &*rmvec {}

clippy_lints/src/absolute_paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ declare_clippy_lint! {
2424
/// using absolute paths is the proper way of referencing items in one.
2525
///
2626
/// ### Example
27-
/// ```rust
27+
/// ```no_run
2828
/// let x = std::f64::consts::PI;
2929
/// ```
3030
/// Use any of the below instead, or anything else:
31-
/// ```rust
31+
/// ```no_run
3232
/// use std::f64;
3333
/// use std::f64::consts;
3434
/// use std::f64::consts::PI;

clippy_lints/src/almost_complete_range.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ declare_clippy_lint! {
1717
/// This (`'a'..'z'`) is almost certainly a typo meant to include all letters.
1818
///
1919
/// ### Example
20-
/// ```rust
20+
/// ```no_run
2121
/// let _ = 'a'..'z';
2222
/// ```
2323
/// Use instead:
24-
/// ```rust
24+
/// ```no_run
2525
/// let _ = 'a'..='z';
2626
/// ```
2727
#[clippy::version = "1.68.0"]

clippy_lints/src/approx_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ declare_clippy_lint! {
2424
/// issue](https://github.com/rust-lang/rust/issues).
2525
///
2626
/// ### Example
27-
/// ```rust
27+
/// ```no_run
2828
/// let x = 3.14;
2929
/// let y = 1_f64 / x;
3030
/// ```
3131
/// Use instead:
32-
/// ```rust
32+
/// ```no_run
3333
/// let x = std::f32::consts::PI;
3434
/// let y = std::f64::consts::FRAC_1_PI;
3535
/// ```

clippy_lints/src/arc_with_non_send_sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ declare_clippy_lint! {
1818
/// either `T` should be made `Send + Sync` or an `Rc` should be used instead of an `Arc`
1919
///
2020
/// ### Example
21-
/// ```rust
21+
/// ```no_run
2222
/// # use std::cell::RefCell;
2323
/// # use std::sync::Arc;
2424
///

clippy_lints/src/async_yields_async.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare_clippy_lint! {
1515
/// An await is likely missing.
1616
///
1717
/// ### Example
18-
/// ```rust
18+
/// ```no_run
1919
/// async fn foo() {}
2020
///
2121
/// fn bar() {
@@ -26,7 +26,7 @@ declare_clippy_lint! {
2626
/// ```
2727
///
2828
/// Use instead:
29-
/// ```rust
29+
/// ```no_run
3030
/// async fn foo() {}
3131
///
3232
/// fn bar() {

clippy_lints/src/attrs.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ declare_clippy_lint! {
129129
/// a valid semver. Failing that, the contained information is useless.
130130
///
131131
/// ### Example
132-
/// ```rust
132+
/// ```no_run
133133
/// #[deprecated(since = "forever")]
134134
/// fn something_else() { /* ... */ }
135135
/// ```
@@ -156,14 +156,14 @@ declare_clippy_lint! {
156156
/// currently works for basic cases but is not perfect.
157157
///
158158
/// ### Example
159-
/// ```rust
159+
/// ```no_run
160160
/// #[allow(dead_code)]
161161
///
162162
/// fn not_quite_good_code() { }
163163
/// ```
164164
///
165165
/// Use instead:
166-
/// ```rust
166+
/// ```no_run
167167
/// // Good (as inner attribute)
168168
/// #![allow(dead_code)]
169169
///
@@ -198,25 +198,25 @@ declare_clippy_lint! {
198198
/// Does not detect empty lines after doc attributes (e.g. `#[doc = ""]`).
199199
///
200200
/// ### Example
201-
/// ```rust
201+
/// ```no_run
202202
/// /// Some doc comment with a blank line after it.
203203
///
204204
/// fn not_quite_good_code() { }
205205
/// ```
206206
///
207207
/// Use instead:
208-
/// ```rust
208+
/// ```no_run
209209
/// /// Good (no blank line)
210210
/// fn this_is_fine() { }
211211
/// ```
212212
///
213-
/// ```rust
213+
/// ```no_run
214214
/// // Good (convert to a regular comment)
215215
///
216216
/// fn this_is_fine_too() { }
217217
/// ```
218218
///
219-
/// ```rust
219+
/// ```no_run
220220
/// //! Good (convert to a comment on an inner attribute)
221221
///
222222
/// fn this_is_fine_as_well() { }
@@ -236,12 +236,12 @@ declare_clippy_lint! {
236236
/// These lints should only be enabled on a lint-by-lint basis and with careful consideration.
237237
///
238238
/// ### Example
239-
/// ```rust
239+
/// ```no_run
240240
/// #![deny(clippy::restriction)]
241241
/// ```
242242
///
243243
/// Use instead:
244-
/// ```rust
244+
/// ```no_run
245245
/// #![deny(clippy::as_conversions)]
246246
/// ```
247247
#[clippy::version = "1.47.0"]
@@ -265,13 +265,13 @@ declare_clippy_lint! {
265265
/// [#3123](https://github.com/rust-lang/rust-clippy/pull/3123#issuecomment-422321765)
266266
///
267267
/// ### Example
268-
/// ```rust
268+
/// ```no_run
269269
/// #[cfg_attr(rustfmt, rustfmt_skip)]
270270
/// fn main() { }
271271
/// ```
272272
///
273273
/// Use instead:
274-
/// ```rust
274+
/// ```no_run
275275
/// #[rustfmt::skip]
276276
/// fn main() { }
277277
/// ```
@@ -290,13 +290,13 @@ declare_clippy_lint! {
290290
/// by the conditional compilation engine.
291291
///
292292
/// ### Example
293-
/// ```rust
293+
/// ```no_run
294294
/// #[cfg(linux)]
295295
/// fn conditional() { }
296296
/// ```
297297
///
298298
/// Use instead:
299-
/// ```rust
299+
/// ```no_run
300300
/// # mod hidden {
301301
/// #[cfg(target_os = "linux")]
302302
/// fn conditional() { }
@@ -325,14 +325,14 @@ declare_clippy_lint! {
325325
/// ensure that others understand the reasoning
326326
///
327327
/// ### Example
328-
/// ```rust
328+
/// ```no_run
329329
/// #![feature(lint_reasons)]
330330
///
331331
/// #![allow(clippy::some_lint)]
332332
/// ```
333333
///
334334
/// Use instead:
335-
/// ```rust
335+
/// ```no_run
336336
/// #![feature(lint_reasons)]
337337
///
338338
/// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]
@@ -352,7 +352,7 @@ declare_clippy_lint! {
352352
/// panicking with the expected message, and not another unrelated panic.
353353
///
354354
/// ### Example
355-
/// ```rust
355+
/// ```no_run
356356
/// fn random() -> i32 { 0 }
357357
///
358358
/// #[should_panic]
@@ -363,7 +363,7 @@ declare_clippy_lint! {
363363
/// ```
364364
///
365365
/// Use instead:
366-
/// ```rust
366+
/// ```no_run
367367
/// fn random() -> i32 { 0 }
368368
///
369369
/// #[should_panic = "attempt to divide by zero"]
@@ -386,13 +386,13 @@ declare_clippy_lint! {
386386
/// If there is only one condition, no need to wrap it into `any` or `all` combinators.
387387
///
388388
/// ### Example
389-
/// ```rust
389+
/// ```no_run
390390
/// #[cfg(any(unix))]
391391
/// pub struct Bar;
392392
/// ```
393393
///
394394
/// Use instead:
395-
/// ```rust
395+
/// ```no_run
396396
/// #[cfg(unix)]
397397
/// pub struct Bar;
398398
/// ```
@@ -412,13 +412,13 @@ declare_clippy_lint! {
412412
/// may cause conditional compilation not work quitely.
413413
///
414414
/// ### Example
415-
/// ```rust
415+
/// ```no_run
416416
/// #[cfg(features = "some-feature")]
417417
/// fn conditional() { }
418418
/// ```
419419
///
420420
/// Use instead:
421-
/// ```rust
421+
/// ```no_run
422422
/// #[cfg(feature = "some-feature")]
423423
/// fn conditional() { }
424424
/// ```

clippy_lints/src/await_holding_invalid.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ declare_clippy_lint! {
2929
/// to wrap the `.lock()` call in a block instead of explicitly dropping the guard.
3030
///
3131
/// ### Example
32-
/// ```rust
32+
/// ```no_run
3333
/// # use std::sync::Mutex;
3434
/// # async fn baz() {}
3535
/// async fn foo(x: &Mutex<u32>) {
@@ -47,7 +47,7 @@ declare_clippy_lint! {
4747
/// ```
4848
///
4949
/// Use instead:
50-
/// ```rust
50+
/// ```no_run
5151
/// # use std::sync::Mutex;
5252
/// # async fn baz() {}
5353
/// async fn foo(x: &Mutex<u32>) {
@@ -87,7 +87,7 @@ declare_clippy_lint! {
8787
/// to wrap the `.borrow[_mut]()` call in a block instead of explicitly dropping the ref.
8888
///
8989
/// ### Example
90-
/// ```rust
90+
/// ```no_run
9191
/// # use std::cell::RefCell;
9292
/// # async fn baz() {}
9393
/// async fn foo(x: &RefCell<u32>) {
@@ -105,7 +105,7 @@ declare_clippy_lint! {
105105
/// ```
106106
///
107107
/// Use instead:
108-
/// ```rust
108+
/// ```no_run
109109
/// # use std::cell::RefCell;
110110
/// # async fn baz() {}
111111
/// async fn foo(x: &RefCell<u32>) {
@@ -151,7 +151,7 @@ declare_clippy_lint! {
151151
/// ]
152152
/// ```
153153
///
154-
/// ```rust
154+
/// ```no_run
155155
/// # async fn baz() {}
156156
/// struct CustomLockType;
157157
/// struct OtherCustomLockType;

clippy_lints/src/blocks_in_if_conditions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ declare_clippy_lint! {
2121
/// Style, using blocks in the condition makes it hard to read.
2222
///
2323
/// ### Examples
24-
/// ```rust
24+
/// ```no_run
2525
/// # fn somefunc() -> bool { true };
2626
/// if { true } { /* ... */ }
2727
///
2828
/// if { let x = somefunc(); x } { /* ... */ }
2929
/// ```
3030
///
3131
/// Use instead:
32-
/// ```rust
32+
/// ```no_run
3333
/// # fn somefunc() -> bool { true };
3434
/// if true { /* ... */ }
3535
///

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ declare_clippy_lint! {
1818
/// It is shorter to use the equivalent.
1919
///
2020
/// ### Example
21-
/// ```rust
21+
/// ```no_run
2222
/// assert_eq!("a".is_empty(), false);
2323
/// assert_ne!("a".is_empty(), true);
2424
/// ```
2525
///
2626
/// Use instead:
27-
/// ```rust
27+
/// ```no_run
2828
/// assert!(!"a".is_empty());
2929
/// ```
3030
#[clippy::version = "1.53.0"]

clippy_lints/src/bool_to_int_with_if.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare_clippy_lint! {
2121
/// See https://doc.rust-lang.org/std/primitive.bool.html#impl-From%3Cbool%3E
2222
///
2323
/// ### Example
24-
/// ```rust
24+
/// ```no_run
2525
/// # let condition = false;
2626
/// if condition {
2727
/// 1_i64
@@ -30,12 +30,12 @@ declare_clippy_lint! {
3030
/// };
3131
/// ```
3232
/// Use instead:
33-
/// ```rust
33+
/// ```no_run
3434
/// # let condition = false;
3535
/// i64::from(condition);
3636
/// ```
3737
/// or
38-
/// ```rust
38+
/// ```no_run
3939
/// # let condition = false;
4040
/// condition as i64;
4141
/// ```

clippy_lints/src/borrow_deref_ref.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare_clippy_lint! {
1919
///
2020
/// ### Known problems
2121
/// False negative on such code:
22-
/// ```
22+
/// ```no_run
2323
/// let x = &12;
2424
/// let addr_x = &x as *const _ as usize;
2525
/// let addr_y = &&*x as *const _ as usize; // assert ok now, and lint triggered.
@@ -28,14 +28,14 @@ declare_clippy_lint! {
2828
/// ```
2929
///
3030
/// ### Example
31-
/// ```rust
31+
/// ```no_run
3232
/// let s = &String::new();
3333
///
3434
/// let a: &String = &* s;
3535
/// ```
3636
///
3737
/// Use instead:
38-
/// ```rust
38+
/// ```no_run
3939
/// # let s = &String::new();
4040
/// let a: &String = s;
4141
/// ```

0 commit comments

Comments
 (0)