]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/branches_sharing_code/false_positives.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / branches_sharing_code / false_positives.rs
CommitLineData
136023e0
XL
1#![allow(dead_code)]
2#![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
3
4// ##################################
5// # Issue clippy#7369
6// ##################################
7#[derive(Debug)]
8pub struct FooBar {
9 foo: Vec<u32>,
10}
11
12impl FooBar {
13 pub fn bar(&mut self) {
14 if true {
15 self.foo.pop();
16 } else {
17 self.baz();
18
19 self.foo.pop();
20
21 self.baz()
22 }
23 }
24
25 fn baz(&mut self) {}
26}
27
923072b8
FG
28fn foo(x: u32, y: u32) -> u32 {
29 x / y
30}
31
32fn main() {
33 let x = (1, 2);
34 let _ = if true {
35 let (x, y) = x;
36 foo(x, y)
37 } else {
38 let (y, x) = x;
39 foo(x, y)
40 };
41}