Skip to content

Commit

Permalink
Fix noop_method_call warning in doctest
Browse files Browse the repository at this point in the history
```
error: call to `.clone()` on a reference in this situation does nothing
  --> crossbeam-epoch/src/guard.rs:451:38
   |
14 |     let dummy = &epoch::unprotected().clone();
   |                                      ^^^^^^^^ help: remove this redundant call
   |
   = note: the type `Guard` does not implement `Clone`, so calling `clone` on `&Guard` copies the reference, which does not do anything and can be removed
note: the lint level is defined here
  --> crossbeam-epoch/src/guard.rs:438:9
   |
1  | #![deny(warnings, rust_2018_idioms)]
   |         ^^^^^^^^
   = note: `#[deny(noop_method_call)]` implied by `#[deny(warnings)]`
```
  • Loading branch information
taiki-e committed Aug 5, 2023
1 parent 5f4c0f0 commit 87c7d7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crossbeam-epoch/src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ impl fmt::Debug for Guard {
/// // Load `a` without pinning the current thread.
/// a.load(Relaxed, epoch::unprotected());
///
/// // It's possible to create more dummy guards by calling `clone()`.
/// let dummy = &epoch::unprotected().clone();
/// // It's possible to create more dummy guards.
/// let dummy = epoch::unprotected();
///
/// dummy.defer(move || {
/// println!("This gets executed immediately.");
Expand Down

0 comments on commit 87c7d7b

Please sign in to comment.