Skip to content

Commit f737fdc

Browse files
committed
config: use BTreeSet contains instead of iterator
Since we have an actual set type, this should be faster (although we probably will not ever have very many names). Signed-off-by: Paul Osborne <[email protected]>
1 parent 42f3d02 commit f737fdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl GpioConfig {
184184

185185
/// Get the pin with the provided name if present in this configuration
186186
pub fn get_pin(&self, name: &str) -> Option<&PinConfig> {
187-
self.pins.iter().find(|p| p.names.iter().any(|n| n == name))
187+
self.pins.iter().find(|p| p.names.contains(name))
188188
}
189189

190190
/// Get a reference to all the pins in this config

0 commit comments

Comments
 (0)