]> git.lizzy.rs Git - rust.git/blob - tests/ui/clone_on_copy.rs
Handle imports which are nested directly
[rust.git] / tests / ui / clone_on_copy.rs
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     clippy::vec_init_then_push
10 )]
11
12 use std::cell::RefCell;
13 use std::rc::{self, Rc};
14 use std::sync::{self, Arc};
15
16 fn main() {}
17
18 fn is_ascii(ch: char) -> bool {
19     ch.is_ascii()
20 }
21
22 fn clone_on_copy() {
23     42.clone();
24
25     vec![1].clone(); // ok, not a Copy type
26     Some(vec![1]).clone(); // ok, not a Copy type
27     (&42).clone();
28
29     let rc = RefCell::new(0);
30     rc.borrow().clone();
31
32     // Issue #4348
33     let mut x = 43;
34     let _ = &x.clone(); // ok, getting a ref
35     'a'.clone().make_ascii_uppercase(); // ok, clone and then mutate
36     is_ascii('z'.clone());
37
38     // Issue #5436
39     let mut vec = Vec::new();
40     vec.push(42.clone());
41 }