Skip to content

Commit ce82879

Browse files
committed
Address all issues brought up by clippy
Nothing serious but there were a few extra clones and the like that are not needed. Signed-off-by: Paul Osborne <osbpau@gmail.com>
1 parent cbae7c5 commit ce82879

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::str::FromStr;
1717
use sysfs_gpio;
1818
use toml;
1919

20-
const DEFAULT_SYMLINK_ROOT: &'static str = "/var/run/gpio";
20+
const DEFAULT_SYMLINK_ROOT: &str = "/var/run/gpio";
2121

2222
#[derive(Debug, PartialEq, Clone)]
2323
pub struct Direction(pub sysfs_gpio::Direction);
@@ -118,7 +118,7 @@ impl FromStr for GpioConfig {
118118
match cfg {
119119
Ok(cfg) => {
120120
let val_config: GpioConfig = toml::from_str(&config).unwrap();
121-
(val_config.validate().or_else(|e| Err(Error::from(e))))?;
121+
val_config.validate()?;
122122
Ok(cfg)
123123
}
124124
Err(e) => Err(Error::ParserErrors(e)),
@@ -244,7 +244,7 @@ impl GpioConfig {
244244
let existing = match self.pins.iter_mut().find(|p| p.num == other_pin.num) {
245245
Some(pin) => {
246246
pin.names.extend(other_pin.names.clone());
247-
pin.direction = other_pin.direction.clone(); // TODO impl copy
247+
pin.direction = other_pin.direction;
248248
pin.export = other_pin.export;
249249
pin.active_low = other_pin.active_low;
250250
true

src/export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ pub fn export(pin_config: &PinConfig, symlink_root: Option<&str>) -> Result<()>
128128
// set the pin direction
129129
pin_config
130130
.get_pin()
131-
.set_direction(pin_config.direction.clone())?;
131+
.set_direction(pin_config.direction)?;
132132

133133
// set active low directio
134134
pin_config
135135
.get_pin()
136-
.set_active_low(pin_config.active_low.clone())?;
136+
.set_active_low(pin_config.active_low)?;
137137

138138
// create symlink for each name
139139
for name in &pin_config.names {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ fn main() {
165165
let poll_options = GpioPollOptions {
166166
gpio_opts: gpio_options,
167167
edge: m.value_of("edge").unwrap_or("both"),
168-
timeout: timeout,
169168
pin: m.value_of("pin").unwrap(),
169+
timeout,
170170
};
171171
gpio_poll::main(&cfg, &poll_options);
172172
}

0 commit comments

Comments
 (0)