summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/repeat_once.rs
blob: 0ec5127117c6efab7484649994c9775cb68105e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-rustfix
#![warn(clippy::repeat_once)]
#[allow(unused, clippy::redundant_clone)]
fn main() {
    const N: usize = 1;
    let s = "str";
    let string = "String".to_string();
    let slice = [1; 5];

    let a = [1; 5].repeat(1);
    let b = slice.repeat(1);
    let c = "hello".repeat(N);
    let d = "hi".repeat(1);
    let e = s.repeat(1);
    let f = string.repeat(1);
}