summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/clone_on_copy.fixed
blob: 1f0ca101757ec849a7d51ef30db43894f7dc742f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// run-rustfix

#![allow(
    unused,
    clippy::redundant_clone,
    clippy::deref_addrof,
    clippy::no_effect,
    clippy::unnecessary_operation
)]

use std::cell::RefCell;
use std::rc::{self, Rc};
use std::sync::{self, Arc};

fn main() {}

fn is_ascii(ch: char) -> bool {
    ch.is_ascii()
}

fn clone_on_copy() {
    42;

    vec![1].clone(); // ok, not a Copy type
    Some(vec![1]).clone(); // ok, not a Copy type
    *(&42);

    let rc = RefCell::new(0);
    *rc.borrow();

    // Issue #4348
    let mut x = 43;
    let _ = &x.clone(); // ok, getting a ref
    'a'.clone().make_ascii_uppercase(); // ok, clone and then mutate
    is_ascii('z');

    // Issue #5436
    let mut vec = Vec::new();
    vec.push(42);
}