]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/match_single_binding.rs
1 #![warn(clippy::match_single_binding)]
4 clippy
::let_unit_value
,
6 clippy
::toplevel_ref_arg
,
7 clippy
::uninlined_format_args
,
16 fn coords() -> Point
{
23 _
=> println
!("whatever"),
35 println
!("{} {} {}", x
, y
, z
);
40 (x
, y
, z
) => println
!("{} {} {}", x
, y
, z
),
47 _
=> println
!("Not 2"),
52 Some(d
) => println
!("{}", d
),
53 _
=> println
!("None"),
57 _
=> println
!("whatever"),
63 println
!("x has a value of {}", x
);
71 println
!("e is superior to 5");
76 let p
= Point { x: 0, y: 7 }
;
78 Point { x, y }
=> println
!("Coords: ({}, {})", x
, y
),
82 Point { x: x1, y: y1 }
=> println
!("Coords: ({}, {})", x1
, y1
),
87 ref r
=> println
!("Got a reference to {}", r
),
92 ref mut mr
=> println
!("Got a mutable reference to {}", mr
),
95 let product
= match coords() {
96 Point { x, y }
=> x
* y
,
99 let v
= vec
![Some(1), Some(2), Some(3), Some(4)];
100 #[allow(clippy::let_and_return)]
103 .map(|i
| match i
.unwrap() {
104 unwrapped
=> unwrapped
,
106 .collect
::<Vec
<u8>>();
110 #[cfg(disabled_feature)]
111 0 => println
!("Disabled branch"),
112 _
=> println
!("Enabled branch"),
122 #[cfg(disabled_feature)]
123 0 => println
!("Array index start"),
124 _
=> println
!("Not an array index start"),
131 _
=> println
!("Not an array index start"),
136 let (mut val
, idx
) = ("a b", 1);
138 val
= match val
.split_at(idx
) {
151 let _
= || match side_effects() {
152 _
=> println
!("Needs curlies"),
156 fn issue_9725(r
: Option
<u32>) {
169 fn issue_10447() -> usize {