]>
Commit | Line | Data |
---|---|---|
353b0b11 FG |
1 | #![allow(unused)] |
2 | #![warn(clippy::manual_main_separator_str)] | |
3 | ||
4 | use std::path::MAIN_SEPARATOR; | |
5 | ||
6 | fn len(s: &str) -> usize { | |
7 | s.len() | |
8 | } | |
9 | ||
10 | struct U<'a> { | |
11 | f: &'a str, | |
12 | g: &'a String, | |
13 | } | |
14 | ||
15 | struct V<T> { | |
16 | f: T, | |
17 | } | |
18 | ||
19 | fn main() { | |
20 | // Should lint | |
21 | let _: &str = std::path::MAIN_SEPARATOR_STR; | |
22 | let _ = len(std::path::MAIN_SEPARATOR_STR); | |
23 | let _: Vec<u16> = std::path::MAIN_SEPARATOR_STR.encode_utf16().collect(); | |
24 | ||
25 | // Should lint for field `f` only | |
26 | let _ = U { | |
27 | f: std::path::MAIN_SEPARATOR_STR, | |
28 | g: &MAIN_SEPARATOR.to_string(), | |
29 | }; | |
30 | ||
31 | // Should not lint | |
32 | let _: &String = &MAIN_SEPARATOR.to_string(); | |
33 | let _ = &MAIN_SEPARATOR.to_string(); | |
34 | let _ = V { | |
35 | f: &MAIN_SEPARATOR.to_string(), | |
36 | }; | |
37 | } |