about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/string_slice.rs
blob: 0acc48c1f41218beeb91ddc0bf676daca91e1855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![warn(clippy::string_slice)]
#![allow(clippy::no_effect)]

use std::borrow::Cow;

fn main() {
    &"Ölkanne"[1..];
    //~^ string_slice

    let m = "Mötörhead";
    &m[2..5];
    //~^ string_slice

    let s = String::from(m);
    &s[0..2];
    //~^ string_slice

    let a = Cow::Borrowed("foo");
    &a[0..3];
    //~^ string_slice
}