Skip to content

Commit 0121111

Browse files
committed
Fix clippy
1 parent 94b2a81 commit 0121111

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ unnecessary_literal_bound = "warn"
228228
unnecessary_safety_doc = "warn"
229229
unnecessary_struct_initialization = "warn"
230230
unnecessary_wraps = "warn"
231-
unnested_or_patterns = "warn"
232231
unused_peekable = "warn"
233232
unused_rounding = "warn"
234233
unused_self = "warn"

src/app.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::HashSet, hash::Hash, u32};
1+
use std::{collections::HashSet, hash::Hash};
22

33
use egui::{
44
Align, Button, Color32, Image, Layout, Pos2, Rect, Sense, Stroke, Ui, Vec2, Widget as _, pos2,
@@ -841,20 +841,16 @@ impl TemplateApp {
841841
let input1_p = current.contains(&input1);
842842
let input2_p = current.contains(&input2);
843843

844-
match (input1_p, input2_p) {
845-
(true, true) => {}
846-
(true, false) | (false, true) | (false, false) => {
847-
let new_on = Pin {
848-
ins: instance.id,
849-
index: 1,
850-
};
851-
current.insert(new_on);
852-
self.flow_current(new_on, &mut current, &mut seen);
853-
}
844+
if input1_p && input2_p {
845+
let new_on = Pin {
846+
ins: instance.id,
847+
index: 1,
848+
};
849+
current.insert(new_on);
850+
self.flow_current(new_on, &mut current, &mut seen);
854851
}
855852
}
856-
InstanceType::Wire(_) => {}
857-
InstanceType::Power(_) => {}
853+
InstanceType::Wire(_) | InstanceType::Power(_) => {}
858854
}
859855
}
860856
self.current = current;
@@ -1002,14 +998,13 @@ impl TemplateApp {
1002998
// Also add current for other pins in the other_pin instance
1003999
let instance = self.get_instance(other_pin.ins);
10041000
match instance.ty {
1005-
InstanceType::Gate(_) => {}
1001+
InstanceType::Gate(_) | InstanceType::Power(_) => {}
10061002
InstanceType::Wire(_) => {
10071003
for pin in instance.pins() {
10081004
current.insert(pin);
10091005
self.flow_current(pin, current, seen);
10101006
}
10111007
}
1012-
InstanceType::Power(_) => {}
10131008
}
10141009
self.flow_current(other_pin, current, seen);
10151010
}

todo.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
- Add current
2-
- Add wires
3-
- Structure for adding different gates and pins
1+
- Simplify current calculation
2+
- Move fields to different modules to mutate easily

0 commit comments

Comments
 (0)