Re: [PATCH 1/2] bindings: rust: Align formatting to what's suggested by 'cargo fmt'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 14, 2023 at 7:45 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> Align code to follow what 'cargo fmt' suggests.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux