bindings: rust: Align formatting to what's suggested by 'cargo fmt'
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 24 Jan 2023 08:23:46 +0000 (13:53 +0530)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 24 Jan 2023 09:09:57 +0000 (10:09 +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/gpiosim-sys/src/lib.rs
bindings/rust/libgpiod/src/chip.rs
bindings/rust/libgpiod/src/lib.rs

index c3f5b3fb9fd46b35851cbe2949cc3cc18c3cc5c8..e3630442e24b4d38f338e2fecb7b355c98a31284 100644 (file)
@@ -2,7 +2,7 @@
 // SPDX-FileCopyrightText: 2022 Linaro Ltd.
 // SPDX-FileCopyrightTest: 2022 Viresh Kumar <viresh.kumar@linaro.org>
 
-use libgpiod::{Error, Result, OperationType};
+use libgpiod::{Error, OperationType, Result};
 
 #[allow(non_camel_case_types, non_upper_case_globals)]
 #[cfg_attr(test, allow(deref_nullptr, non_snake_case))]
@@ -16,14 +16,14 @@ mod sim;
 pub use sim::*;
 
 use crate::{
-    gpiosim_value_GPIOSIM_VALUE_INACTIVE as GPIOSIM_VALUE_INACTIVE,
-    gpiosim_value_GPIOSIM_VALUE_ACTIVE as GPIOSIM_VALUE_ACTIVE,
-    gpiosim_value_GPIOSIM_VALUE_ERROR as GPIOSIM_VALUE_ERROR,
     gpiosim_direction_GPIOSIM_DIRECTION_INPUT as GPIOSIM_DIRECTION_INPUT,
     gpiosim_direction_GPIOSIM_DIRECTION_OUTPUT_HIGH as GPIOSIM_DIRECTION_OUTPUT_HIGH,
     gpiosim_direction_GPIOSIM_DIRECTION_OUTPUT_LOW as GPIOSIM_DIRECTION_OUTPUT_LOW,
-    gpiosim_pull_GPIOSIM_PULL_UP as GPIOSIM_PULL_UP,
     gpiosim_pull_GPIOSIM_PULL_DOWN as GPIOSIM_PULL_DOWN,
+    gpiosim_pull_GPIOSIM_PULL_UP as GPIOSIM_PULL_UP,
+    gpiosim_value_GPIOSIM_VALUE_ACTIVE as GPIOSIM_VALUE_ACTIVE,
+    gpiosim_value_GPIOSIM_VALUE_ERROR as GPIOSIM_VALUE_ERROR,
+    gpiosim_value_GPIOSIM_VALUE_INACTIVE as GPIOSIM_VALUE_INACTIVE,
 };
 
 /// Value settings.
@@ -42,7 +42,8 @@ impl Value {
             GPIOSIM_VALUE_ACTIVE => Value::Active,
             GPIOSIM_VALUE_ERROR => {
                 return Err(Error::OperationFailed(
-                    OperationType::SimBankGetVal, errno::errno()
+                    OperationType::SimBankGetVal,
+                    errno::errno(),
                 ))
             }
             _ => return Err(Error::InvalidEnumValue("Value", val as i32)),
index 9c3c2b41417006e05aec7b8002485095e376579a..f4554a11694624ad1145f0e1b14407401683e656 100644 (file)
@@ -206,9 +206,8 @@ impl Chip {
 
         // SAFETY: The `gpiod_line_request` returned by libgpiod is guaranteed to live as long
         // as the `struct Request`.
-        let request = unsafe {
-            gpiod::gpiod_chip_request_lines(self.ichip.chip, req_cfg, lconfig.config)
-        };
+        let request =
+            unsafe { gpiod::gpiod_chip_request_lines(self.ichip.chip, req_cfg, lconfig.config) };
 
         if request.is_null() {
             return Err(Error::OperationFailed(
index a5d018cab73e5e180339ea814ab47db9538b08b2..4abfcf2ba4050a9eff55529097a83193679efa78 100644 (file)
@@ -35,6 +35,9 @@ use gpiod::{
     gpiod_line_bias_GPIOD_LINE_BIAS_PULL_DOWN as GPIOD_LINE_BIAS_PULL_DOWN,
     gpiod_line_bias_GPIOD_LINE_BIAS_PULL_UP as GPIOD_LINE_BIAS_PULL_UP,
     gpiod_line_bias_GPIOD_LINE_BIAS_UNKNOWN as GPIOD_LINE_BIAS_UNKNOWN,
+    gpiod_line_clock_GPIOD_LINE_CLOCK_HTE as GPIOD_LINE_CLOCK_HTE,
+    gpiod_line_clock_GPIOD_LINE_CLOCK_MONOTONIC as GPIOD_LINE_CLOCK_MONOTONIC,
+    gpiod_line_clock_GPIOD_LINE_CLOCK_REALTIME as GPIOD_LINE_CLOCK_REALTIME,
     gpiod_line_direction_GPIOD_LINE_DIRECTION_AS_IS as GPIOD_LINE_DIRECTION_AS_IS,
     gpiod_line_direction_GPIOD_LINE_DIRECTION_INPUT as GPIOD_LINE_DIRECTION_INPUT,
     gpiod_line_direction_GPIOD_LINE_DIRECTION_OUTPUT as GPIOD_LINE_DIRECTION_OUTPUT,
@@ -45,12 +48,9 @@ use gpiod::{
     gpiod_line_edge_GPIOD_LINE_EDGE_FALLING as GPIOD_LINE_EDGE_FALLING,
     gpiod_line_edge_GPIOD_LINE_EDGE_NONE as GPIOD_LINE_EDGE_NONE,
     gpiod_line_edge_GPIOD_LINE_EDGE_RISING as GPIOD_LINE_EDGE_RISING,
-    gpiod_line_clock_GPIOD_LINE_CLOCK_HTE as GPIOD_LINE_CLOCK_HTE,
-    gpiod_line_clock_GPIOD_LINE_CLOCK_MONOTONIC as GPIOD_LINE_CLOCK_MONOTONIC,
-    gpiod_line_clock_GPIOD_LINE_CLOCK_REALTIME as GPIOD_LINE_CLOCK_REALTIME,
     gpiod_line_value_GPIOD_LINE_VALUE_ACTIVE as GPIOD_LINE_VALUE_ACTIVE,
-    gpiod_line_value_GPIOD_LINE_VALUE_INACTIVE as GPIOD_LINE_VALUE_INACTIVE,
     gpiod_line_value_GPIOD_LINE_VALUE_ERROR as GPIOD_LINE_VALUE_ERROR,
+    gpiod_line_value_GPIOD_LINE_VALUE_INACTIVE as GPIOD_LINE_VALUE_INACTIVE,
 };
 
 /// Operation types, used with OperationFailed() Error.