]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/clone_on_copy.fixed
Auto merge of #78458 - Dylan-DPC:rollup-tan044s, r=Dylan-DPC
[rust.git] / src / tools / clippy / tests / ui / clone_on_copy.fixed
1 // run-rustfix
2
3 #![allow(
4     unused,
5     clippy::redundant_clone,
6     clippy::deref_addrof,
7     clippy::no_effect,
8     clippy::unnecessary_operation
9 )]
10
11 use std::cell::RefCell;
12 use std::rc::{self, Rc};
13 use std::sync::{self, Arc};
14
15 fn main() {}
16
17 fn is_ascii(ch: char) -> bool {
18     ch.is_ascii()
19 }
20
21 fn clone_on_copy() {
22     42;
23
24     vec![1].clone(); // ok, not a Copy type
25     Some(vec![1]).clone(); // ok, not a Copy type
26     *(&42);
27
28     let rc = RefCell::new(0);
29     *rc.borrow();
30
31     // Issue #4348
32     let mut x = 43;
33     let _ = &x.clone(); // ok, getting a ref
34     'a'.clone().make_ascii_uppercase(); // ok, clone and then mutate
35     is_ascii('z');
36
37     // Issue #5436
38     let mut vec = Vec::new();
39     vec.push(42);
40 }