bindings: rust: align formatting to what's suggested by 'cargo fmt'
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 14 Feb 2023 06:45:34 +0000 (12:15 +0530)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 14 Feb 2023 08:43:08 +0000 (09:43 +0100)
Align code to follow what 'cargo fmt' suggests.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/rust/libgpiod/src/line_config.rs
bindings/rust/libgpiod/tests/line_config.rs
bindings/rust/libgpiod/tests/line_request.rs

index 6ddcec336da28ddea3e57de1d3bb2d1942e72d62..3848a3a683040dca1be12adaf47873824c5630c6 100644 (file)
@@ -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 {
index 6e8962cf686ce5d169697a53a0bc992314837111..b5a04ef8949a772d2b40406a585df502468e12e3 100644 (file)
@@ -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();
 
index 8ec497f8340684b2819a58ca4c0b02dc312500ac..d60e15a7a1063f2b0cf89f8cc3aaf2cf37ac22ab 100644 (file)
@@ -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,