Message ID | 24d754e5d765de80f99d8f8942d7ffeea8f3110c.1676357080.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers | show |
Series | [1/2] bindings: rust: Align formatting to what's suggested by 'cargo fmt' | expand |
On Tue, Feb 14, 2023 at 7:45 AM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > Align code to follow what 'cargo fmt' suggests. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > bindings/rust/libgpiod/src/line_config.rs | 13 ++++++++++--- > bindings/rust/libgpiod/tests/line_config.rs | 4 ++-- > bindings/rust/libgpiod/tests/line_request.rs | 6 ++++-- > 3 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/bindings/rust/libgpiod/src/line_config.rs b/bindings/rust/libgpiod/src/line_config.rs > index 6ddcec336da2..3848a3a68304 100644 > --- a/bindings/rust/libgpiod/src/line_config.rs > +++ b/bindings/rust/libgpiod/src/line_config.rs > @@ -55,7 +55,11 @@ impl Config { > } > > /// Add line settings for a set of offsets. > - pub fn add_line_settings(&mut self, offsets: &[Offset], settings: Settings) -> Result<&mut Self> { > + pub fn add_line_settings( > + &mut self, > + offsets: &[Offset], > + settings: Settings, > + ) -> Result<&mut Self> { > // SAFETY: `gpiod_line_config` is guaranteed to be valid here. > let ret = unsafe { > gpiod::gpiod_line_config_add_line_settings( > @@ -84,8 +88,11 @@ impl Config { > } > > let ret = unsafe { > - gpiod::gpiod_line_config_set_output_values(self.config, mapped_values.as_ptr(), > - values.len() as u64) > + gpiod::gpiod_line_config_set_output_values( > + self.config, > + mapped_values.as_ptr(), > + values.len() as u64, > + ) > }; > > if ret == -1 { > diff --git a/bindings/rust/libgpiod/tests/line_config.rs b/bindings/rust/libgpiod/tests/line_config.rs > index 6e8962cf686c..b5a04ef8949a 100644 > --- a/bindings/rust/libgpiod/tests/line_config.rs > +++ b/bindings/rust/libgpiod/tests/line_config.rs > @@ -5,11 +5,11 @@ > mod common; > > mod line_config { > + use gpiosim_sys::Sim; > use libgpiod::chip::Chip; > use libgpiod::line::{ > self, Bias, Direction, Drive, Edge, EventClock, SettingKind, SettingVal, Value, > }; > - use gpiosim_sys::Sim; > > #[test] > fn settings() { > @@ -93,7 +93,7 @@ mod line_config { > Value::Active, > Value::InActive, > Value::Active, > - Value::InActive > + Value::InActive, > ]) > .unwrap(); > > diff --git a/bindings/rust/libgpiod/tests/line_request.rs b/bindings/rust/libgpiod/tests/line_request.rs > index 8ec497f83406..d60e15a7a106 100644 > --- a/bindings/rust/libgpiod/tests/line_request.rs > +++ b/bindings/rust/libgpiod/tests/line_request.rs > @@ -181,7 +181,8 @@ mod line_request { > assert_eq!(config.sim_val(4).unwrap(), SimValue::InActive); > > // Set all values > - config.request() > + config > + .request() > .set_values(&[ > Value::Active, > Value::InActive, > @@ -193,7 +194,8 @@ mod line_request { > assert_eq!(config.sim_val(1).unwrap(), SimValue::InActive); > assert_eq!(config.sim_val(3).unwrap(), SimValue::Active); > assert_eq!(config.sim_val(4).unwrap(), SimValue::InActive); > - config.request() > + config > + .request() > .set_values(&[ > Value::InActive, > Value::InActive, > -- > 2.31.1.272.g89b43f80a514 > Both patches applied, thanks! Bart
diff --git a/bindings/rust/libgpiod/src/line_config.rs b/bindings/rust/libgpiod/src/line_config.rs index 6ddcec336da2..3848a3a68304 100644 --- a/bindings/rust/libgpiod/src/line_config.rs +++ b/bindings/rust/libgpiod/src/line_config.rs @@ -55,7 +55,11 @@ impl Config { } /// Add line settings for a set of offsets. - pub fn add_line_settings(&mut self, offsets: &[Offset], settings: Settings) -> Result<&mut Self> { + pub fn add_line_settings( + &mut self, + offsets: &[Offset], + settings: Settings, + ) -> Result<&mut Self> { // SAFETY: `gpiod_line_config` is guaranteed to be valid here. let ret = unsafe { gpiod::gpiod_line_config_add_line_settings( @@ -84,8 +88,11 @@ impl Config { } let ret = unsafe { - gpiod::gpiod_line_config_set_output_values(self.config, mapped_values.as_ptr(), - values.len() as u64) + gpiod::gpiod_line_config_set_output_values( + self.config, + mapped_values.as_ptr(), + values.len() as u64, + ) }; if ret == -1 { diff --git a/bindings/rust/libgpiod/tests/line_config.rs b/bindings/rust/libgpiod/tests/line_config.rs index 6e8962cf686c..b5a04ef8949a 100644 --- a/bindings/rust/libgpiod/tests/line_config.rs +++ b/bindings/rust/libgpiod/tests/line_config.rs @@ -5,11 +5,11 @@ mod common; mod line_config { + use gpiosim_sys::Sim; use libgpiod::chip::Chip; use libgpiod::line::{ self, Bias, Direction, Drive, Edge, EventClock, SettingKind, SettingVal, Value, }; - use gpiosim_sys::Sim; #[test] fn settings() { @@ -93,7 +93,7 @@ mod line_config { Value::Active, Value::InActive, Value::Active, - Value::InActive + Value::InActive, ]) .unwrap(); diff --git a/bindings/rust/libgpiod/tests/line_request.rs b/bindings/rust/libgpiod/tests/line_request.rs index 8ec497f83406..d60e15a7a106 100644 --- a/bindings/rust/libgpiod/tests/line_request.rs +++ b/bindings/rust/libgpiod/tests/line_request.rs @@ -181,7 +181,8 @@ mod line_request { assert_eq!(config.sim_val(4).unwrap(), SimValue::InActive); // Set all values - config.request() + config + .request() .set_values(&[ Value::Active, Value::InActive, @@ -193,7 +194,8 @@ mod line_request { assert_eq!(config.sim_val(1).unwrap(), SimValue::InActive); assert_eq!(config.sim_val(3).unwrap(), SimValue::Active); assert_eq!(config.sim_val(4).unwrap(), SimValue::InActive); - config.request() + config + .request() .set_values(&[ Value::InActive, Value::InActive,
Align code to follow what 'cargo fmt' suggests. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- bindings/rust/libgpiod/src/line_config.rs | 13 ++++++++++--- bindings/rust/libgpiod/tests/line_config.rs | 4 ++-- bindings/rust/libgpiod/tests/line_request.rs | 6 ++++-- 3 files changed, 16 insertions(+), 7 deletions(-)