]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/blacklisted_name.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / blacklisted_name.rs
CommitLineData
f20569fa
XL
1#![allow(
2 dead_code,
3 clippy::similar_names,
4 clippy::single_match,
5 clippy::toplevel_ref_arg,
6 unused_mut,
7 unused_variables
8)]
9#![warn(clippy::blacklisted_name)]
10
11fn test(foo: ()) {}
12
13fn main() {
14 let foo = 42;
15 let baz = 42;
16 let quux = 42;
17 // Unlike these others, `bar` is actually considered an acceptable name.
18 // Among many other legitimate uses, bar commonly refers to a period of time in music.
19 // See https://github.com/rust-lang/rust-clippy/issues/5225.
20 let bar = 42;
21
22 let food = 42;
23 let foodstuffs = 42;
24 let bazaar = 42;
25
26 match (42, Some(1337), Some(0)) {
27 (foo, Some(baz), quux @ Some(_)) => (),
28 _ => (),
29 }
30}
31
32fn issue_1647(mut foo: u8) {
33 let mut baz = 0;
34 if let Some(mut quux) = Some(42) {}
35}
36
37fn issue_1647_ref() {
38 let ref baz = 0;
39 if let Some(ref quux) = Some(42) {}
40}
41
42fn issue_1647_ref_mut() {
43 let ref mut baz = 0;
44 if let Some(ref mut quux) = Some(42) {}
45}
136023e0
XL
46
47mod tests {
48 fn issue_7305() {
923072b8 49 // `blacklisted_name` lint should not be triggered inside of the test code.
136023e0
XL
50 let foo = 0;
51
923072b8 52 // Check that even in nested functions warning is still not triggered.
136023e0
XL
53 fn nested() {
54 let foo = 0;
55 }
56 }
57}