From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Erik Wierich <erik@riscstar.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH libgpiod 2/3] bindings: rust: update formatting to --edition 2024
Date: Fri, 26 Sep 2025 16:35:43 +0200 [thread overview]
Message-ID: <20250926-rust-release-tweaks-v1-2-beae932eb691@linaro.org> (raw)
In-Reply-To: <20250926-rust-release-tweaks-v1-0-beae932eb691@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Update the formatting of all rust source files to be up to date with the
2024 rust edition.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/gpiosim-sys/src/lib.rs | 2 +-
bindings/rust/gpiosim-sys/src/sim.rs | 2 +-
.../libgpiod/examples/buffered_event_lifetimes.rs | 2 +-
.../rust/libgpiod/examples/find_line_by_name.rs | 2 +-
bindings/rust/libgpiod/examples/get_chip_info.rs | 2 +-
bindings/rust/libgpiod/examples/get_line_info.rs | 2 +-
bindings/rust/libgpiod/examples/get_line_value.rs | 2 +-
.../libgpiod/examples/get_multiple_line_values.rs | 2 +-
.../examples/reconfigure_input_to_output.rs | 2 +-
.../rust/libgpiod/examples/toggle_line_value.rs | 2 +-
.../examples/toggle_multiple_line_values.rs | 2 +-
bindings/rust/libgpiod/examples/watch_line_info.rs | 2 +-
.../rust/libgpiod/examples/watch_line_rising.rs | 2 +-
.../rust/libgpiod/examples/watch_line_value.rs | 2 +-
.../examples/watch_multiple_line_values.rs | 2 +-
bindings/rust/libgpiod/src/chip.rs | 4 +-
bindings/rust/libgpiod/src/edge_event.rs | 3 +-
bindings/rust/libgpiod/src/event_buffer.rs | 3 +-
bindings/rust/libgpiod/src/info_event.rs | 3 +-
bindings/rust/libgpiod/src/lib.rs | 2 +-
bindings/rust/libgpiod/src/line_config.rs | 3 +-
bindings/rust/libgpiod/src/line_info.rs | 3 +-
bindings/rust/libgpiod/src/line_request.rs | 4 +-
bindings/rust/libgpiod/src/line_settings.rs | 3 +-
bindings/rust/libgpiod/src/request_config.rs | 2 +-
bindings/rust/libgpiod/tests/chip.rs | 2 +-
bindings/rust/libgpiod/tests/common/config.rs | 3 +-
bindings/rust/libgpiod/tests/edge_event.rs | 120 ++++++++++++---------
bindings/rust/libgpiod/tests/info_event.rs | 58 +++++-----
bindings/rust/libgpiod/tests/line_info.rs | 2 +-
bindings/rust/libgpiod/tests/line_request.rs | 12 ++-
bindings/rust/libgpiod/tests/request_config.rs | 2 +-
32 files changed, 144 insertions(+), 115 deletions(-)
diff --git a/bindings/rust/gpiosim-sys/src/lib.rs b/bindings/rust/gpiosim-sys/src/lib.rs
index bf9ae32eda0cf7220e70975e2dfa4c093f46ce90..e03c8e3eabee427f287a389b3425a123689324d6 100644
--- a/bindings/rust/gpiosim-sys/src/lib.rs
+++ b/bindings/rust/gpiosim-sys/src/lib.rs
@@ -44,7 +44,7 @@ impl Value {
return Err(Error::OperationFailed(
OperationType::SimBankGetVal,
errno::errno(),
- ))
+ ));
}
_ => return Err(Error::InvalidEnumValue("Value", val)),
})
diff --git a/bindings/rust/gpiosim-sys/src/sim.rs b/bindings/rust/gpiosim-sys/src/sim.rs
index 85c24948d247c71ffcb364db82473ca43ee2aca9..38ee73a1277c9af37a33995fff35916e50dcfa76 100644
--- a/bindings/rust/gpiosim-sys/src/sim.rs
+++ b/bindings/rust/gpiosim-sys/src/sim.rs
@@ -7,7 +7,7 @@ use std::os::raw::c_char;
use std::path::PathBuf;
use std::str;
-use libgpiod::{line::Offset, Error, OperationType, Result};
+use libgpiod::{Error, OperationType, Result, line::Offset};
use crate::*;
diff --git a/bindings/rust/libgpiod/examples/buffered_event_lifetimes.rs b/bindings/rust/libgpiod/examples/buffered_event_lifetimes.rs
index 7589e1f4187d364f28477c0d410b7e666608ac88..2fc3f08ab9d2bec734b13d8915182f5ebd31b8e1 100644
--- a/bindings/rust/libgpiod/examples/buffered_event_lifetimes.rs
+++ b/bindings/rust/libgpiod/examples/buffered_event_lifetimes.rs
@@ -6,10 +6,10 @@
// subsequent writes to the containing event buffer.
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Edge, Settings},
request::{Buffer, Config as ReqConfig, Event},
- Result,
};
fn main() -> Result<()> {
diff --git a/bindings/rust/libgpiod/examples/find_line_by_name.rs b/bindings/rust/libgpiod/examples/find_line_by_name.rs
index 3652b6419731b7e85d594906a1b5d41eed63fcb6..ddb264c861d9cf93027086367b8f96676fddda4f 100644
--- a/bindings/rust/libgpiod/examples/find_line_by_name.rs
+++ b/bindings/rust/libgpiod/examples/find_line_by_name.rs
@@ -3,7 +3,7 @@
//
// Minimal example of finding a line with the given name.
-use libgpiod::{gpiochip_devices, Result};
+use libgpiod::{Result, gpiochip_devices};
fn main() -> Result<()> {
// Example configuration - customize to suit your situation
diff --git a/bindings/rust/libgpiod/examples/get_chip_info.rs b/bindings/rust/libgpiod/examples/get_chip_info.rs
index 1781d464f0e66471ac1beb038d566eb537fed402..d5d57f863651b3643d75745abdf8e1efad0e342d 100644
--- a/bindings/rust/libgpiod/examples/get_chip_info.rs
+++ b/bindings/rust/libgpiod/examples/get_chip_info.rs
@@ -3,7 +3,7 @@
//
// Minimal example of reading the info for a chip.
-use libgpiod::{self, chip::Chip, Result};
+use libgpiod::{self, Result, chip::Chip};
fn main() -> Result<()> {
// Example configuration - customize to suit your situation
diff --git a/bindings/rust/libgpiod/examples/get_line_info.rs b/bindings/rust/libgpiod/examples/get_line_info.rs
index 36c6fbea4c873be473bbbd7d6b91c6925084c9d8..017f5187b6e2dd791c1d1277be01dae3a129a7d9 100644
--- a/bindings/rust/libgpiod/examples/get_line_info.rs
+++ b/bindings/rust/libgpiod/examples/get_line_info.rs
@@ -3,7 +3,7 @@
//
// Minimal example of reading the info for a line.
-use libgpiod::{chip::Chip, line::Direction, Result};
+use libgpiod::{Result, chip::Chip, line::Direction};
fn main() -> Result<()> {
// Example configuration - customize to suit your situation
diff --git a/bindings/rust/libgpiod/examples/get_line_value.rs b/bindings/rust/libgpiod/examples/get_line_value.rs
index 9986931af29a284131ce21fe11915285264786eb..844e30cda9671928c2041ff5a534100bdcab9d24 100644
--- a/bindings/rust/libgpiod/examples/get_line_value.rs
+++ b/bindings/rust/libgpiod/examples/get_line_value.rs
@@ -4,10 +4,10 @@
// Minimal example of reading a single line.
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Direction, Settings},
request::Config as ReqConfig,
- Result,
};
fn main() -> Result<()> {
diff --git a/bindings/rust/libgpiod/examples/get_multiple_line_values.rs b/bindings/rust/libgpiod/examples/get_multiple_line_values.rs
index a33a787fba4e94060c83a9c909b0f9c74517d7c1..39f0767cff9d62c73ef4f7f753c6de8fdfb45187 100644
--- a/bindings/rust/libgpiod/examples/get_multiple_line_values.rs
+++ b/bindings/rust/libgpiod/examples/get_multiple_line_values.rs
@@ -4,10 +4,10 @@
// Minimal example of reading multiple lines.
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Direction, Settings},
request::Config as ReqConfig,
- Result,
};
fn main() -> Result<()> {
diff --git a/bindings/rust/libgpiod/examples/reconfigure_input_to_output.rs b/bindings/rust/libgpiod/examples/reconfigure_input_to_output.rs
index ded576529212de4aaea0c025f7d1d38c44baaa7c..b82f19bb407459fed651d06ffc3e5ee3e81da7e3 100644
--- a/bindings/rust/libgpiod/examples/reconfigure_input_to_output.rs
+++ b/bindings/rust/libgpiod/examples/reconfigure_input_to_output.rs
@@ -4,10 +4,10 @@
// Example of a bi-directional line requested as input and then switched to output.
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Direction, Settings, Value},
request::Config as ReqConfig,
- Result,
};
fn main() -> Result<()> {
diff --git a/bindings/rust/libgpiod/examples/toggle_line_value.rs b/bindings/rust/libgpiod/examples/toggle_line_value.rs
index 33b17d5a36364f4a0e9e93c0f68570f764fc31a4..f38a7083bec810da4a44f0f89049640cca7bbb2b 100644
--- a/bindings/rust/libgpiod/examples/toggle_line_value.rs
+++ b/bindings/rust/libgpiod/examples/toggle_line_value.rs
@@ -5,10 +5,10 @@
use core::time::Duration;
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Direction, Settings, Value},
request::Config as ReqConfig,
- Result,
};
use std::thread::sleep;
diff --git a/bindings/rust/libgpiod/examples/toggle_multiple_line_values.rs b/bindings/rust/libgpiod/examples/toggle_multiple_line_values.rs
index 3572deb19734146c4727e05a5273b6ec52fa14e8..a69b3aa086c36b686be6304efaf8ded45a9bc71a 100644
--- a/bindings/rust/libgpiod/examples/toggle_multiple_line_values.rs
+++ b/bindings/rust/libgpiod/examples/toggle_multiple_line_values.rs
@@ -5,10 +5,10 @@
use core::time::Duration;
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Direction, Offset, Settings, Value},
request::Config as ReqConfig,
- Result,
};
use std::thread::sleep;
diff --git a/bindings/rust/libgpiod/examples/watch_line_info.rs b/bindings/rust/libgpiod/examples/watch_line_info.rs
index d724b6749fed19504ad13d8c3eb20aa351d00148..804ae681f4510794ed0930314a004ec19c7c7f18 100644
--- a/bindings/rust/libgpiod/examples/watch_line_info.rs
+++ b/bindings/rust/libgpiod/examples/watch_line_info.rs
@@ -3,7 +3,7 @@
//
// Minimal example of watching for info changes on particular lines.
-use libgpiod::{chip::Chip, line::InfoChangeKind, Result};
+use libgpiod::{Result, chip::Chip, line::InfoChangeKind};
fn main() -> Result<()> {
// Example configuration - customize to suit your situation
diff --git a/bindings/rust/libgpiod/examples/watch_line_rising.rs b/bindings/rust/libgpiod/examples/watch_line_rising.rs
index 77434ae89d3ca76e1686d6debddd88141a3dda08..b0260a4af4602f7deab5c27a5c7480f2ebbb7caa 100644
--- a/bindings/rust/libgpiod/examples/watch_line_rising.rs
+++ b/bindings/rust/libgpiod/examples/watch_line_rising.rs
@@ -4,10 +4,10 @@
// Minimal example of watching for edges on a single line.
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Edge, EdgeKind, Settings},
request::{Buffer, Config as ReqConfig},
- Result,
};
fn main() -> Result<()> {
diff --git a/bindings/rust/libgpiod/examples/watch_line_value.rs b/bindings/rust/libgpiod/examples/watch_line_value.rs
index 3d5bc86724e316077bfb24b8fbf4f2365bb429ab..f7469ddb3d5da1d24ecc76d19e48895737a5c691 100644
--- a/bindings/rust/libgpiod/examples/watch_line_value.rs
+++ b/bindings/rust/libgpiod/examples/watch_line_value.rs
@@ -4,10 +4,10 @@
// Minimal example of watching for edges on a single line.
use libgpiod::{
+ Result,
chip::Chip,
line::{Bias, Config as LineConfig, Edge, EdgeKind, Settings},
request::{Buffer, Config as ReqConfig},
- Result,
};
use std::time::Duration;
diff --git a/bindings/rust/libgpiod/examples/watch_multiple_line_values.rs b/bindings/rust/libgpiod/examples/watch_multiple_line_values.rs
index 10079ac8cc0da733adeadefd101455c046eaa7fd..c9d65e612ae1206f419f1d350cf30b0e93190987 100644
--- a/bindings/rust/libgpiod/examples/watch_multiple_line_values.rs
+++ b/bindings/rust/libgpiod/examples/watch_multiple_line_values.rs
@@ -4,10 +4,10 @@
// Minimal example of watching for edges on multiple lines.
use libgpiod::{
+ Result,
chip::Chip,
line::{Config as LineConfig, Edge, EdgeKind, Settings},
request::{Buffer, Config as ReqConfig},
- Result,
};
fn main() -> Result<()> {
diff --git a/bindings/rust/libgpiod/src/chip.rs b/bindings/rust/libgpiod/src/chip.rs
index df1cef3bdef5d2014e951437c9fe89c119bff48c..1e98cb28efe97d7cd97363a62cd5b2b346cf381a 100644
--- a/bindings/rust/libgpiod/src/chip.rs
+++ b/bindings/rust/libgpiod/src/chip.rs
@@ -16,9 +16,9 @@ use std::str;
use std::time::Duration;
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
line::{self, Offset},
- request, Error, OperationType, Result,
+ request,
};
/// GPIO chip
diff --git a/bindings/rust/libgpiod/src/edge_event.rs b/bindings/rust/libgpiod/src/edge_event.rs
index 7f8f3773ef4005ac41b5aa2504340069f3adad5d..45caf9ead0afa72dc0d5ea2f4facabb15b4bef2a 100644
--- a/bindings/rust/libgpiod/src/edge_event.rs
+++ b/bindings/rust/libgpiod/src/edge_event.rs
@@ -5,9 +5,8 @@
use std::time::Duration;
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
line::{EdgeKind, Offset},
- Error, OperationType, Result,
};
/// Line edge events handling
diff --git a/bindings/rust/libgpiod/src/event_buffer.rs b/bindings/rust/libgpiod/src/event_buffer.rs
index 059de1adabb858ba211446b27312c60429c6cc07..4f8ae63907b5886abd5ab581f677f7ad4cc2ce96 100644
--- a/bindings/rust/libgpiod/src/event_buffer.rs
+++ b/bindings/rust/libgpiod/src/event_buffer.rs
@@ -5,9 +5,8 @@
use std::ptr;
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
request::{Event, Request},
- Error, OperationType, Result,
};
/// Line edge events
diff --git a/bindings/rust/libgpiod/src/info_event.rs b/bindings/rust/libgpiod/src/info_event.rs
index f23701ab43ce5c215bb5260cd608d8e46b927079..4338680e83a7f4065099190408d0b503bfad9575 100644
--- a/bindings/rust/libgpiod/src/info_event.rs
+++ b/bindings/rust/libgpiod/src/info_event.rs
@@ -5,9 +5,8 @@
use std::time::Duration;
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
line::{self, InfoChangeKind},
- Error, OperationType, Result,
};
/// Line status watch events
diff --git a/bindings/rust/libgpiod/src/lib.rs b/bindings/rust/libgpiod/src/lib.rs
index 76a2c1b76f3cf365866797742011b780ee5795d8..aacc82e79dc77f9563d90adaf5fcffeb86ce690b 100644
--- a/bindings/rust/libgpiod/src/lib.rs
+++ b/bindings/rust/libgpiod/src/lib.rs
@@ -192,7 +192,7 @@ pub mod line {
return Err(Error::OperationFailed(
OperationType::LineRequestGetVal,
errno::errno(),
- ))
+ ));
}
_ => return Err(Error::InvalidEnumValue("Value", val)),
})
diff --git a/bindings/rust/libgpiod/src/line_config.rs b/bindings/rust/libgpiod/src/line_config.rs
index 5850b9da3cba0d75f475246592796c2c52570e8e..e78b77b4df2aa932a9e976db3529e71fd0ef2137 100644
--- a/bindings/rust/libgpiod/src/line_config.rs
+++ b/bindings/rust/libgpiod/src/line_config.rs
@@ -3,9 +3,8 @@
// SPDX-FileCopyrightText: 2022 Viresh Kumar <viresh.kumar@linaro.org>
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
line::{Offset, Settings, SettingsMap, Value},
- Error, OperationType, Result,
};
/// Line configuration objects.
diff --git a/bindings/rust/libgpiod/src/line_info.rs b/bindings/rust/libgpiod/src/line_info.rs
index 8def1ab4e52962fffa6911976e64204c3d02df6f..fc7f47dce103e5728fab90079d02cb3004882634 100644
--- a/bindings/rust/libgpiod/src/line_info.rs
+++ b/bindings/rust/libgpiod/src/line_info.rs
@@ -8,9 +8,8 @@ use std::time::Duration;
use std::{ffi::CStr, marker::PhantomData};
use super::{
- gpiod,
+ Error, Result, gpiod,
line::{Bias, Direction, Drive, Edge, EventClock, Offset},
- Error, Result,
};
/// Line info reference
diff --git a/bindings/rust/libgpiod/src/line_request.rs b/bindings/rust/libgpiod/src/line_request.rs
index 48d8d1a3a6fb5110ef295971cf44bcc70ff68c58..723a2903cdcef91edee30d54a41745d6c65f4097 100644
--- a/bindings/rust/libgpiod/src/line_request.rs
+++ b/bindings/rust/libgpiod/src/line_request.rs
@@ -8,9 +8,9 @@ use std::os::unix::prelude::AsRawFd;
use std::time::Duration;
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
line::{self, Offset, Value, ValueMap},
- request, Error, OperationType, Result,
+ request,
};
/// Line request operations
diff --git a/bindings/rust/libgpiod/src/line_settings.rs b/bindings/rust/libgpiod/src/line_settings.rs
index 9ab8ea7173c4f214e6d513434435a144424ecc74..ce2aa564b3fdd8b1533290ba001e60311a9fe9d2 100644
--- a/bindings/rust/libgpiod/src/line_settings.rs
+++ b/bindings/rust/libgpiod/src/line_settings.rs
@@ -5,9 +5,8 @@
use std::time::Duration;
use super::{
- gpiod,
+ Error, OperationType, Result, gpiod,
line::{Bias, Direction, Drive, Edge, EventClock, SettingKind, SettingVal, Value},
- Error, OperationType, Result,
};
/// Line settings objects.
diff --git a/bindings/rust/libgpiod/src/request_config.rs b/bindings/rust/libgpiod/src/request_config.rs
index 9b66cc9d25e3a291e913476721b8e0bbad1edd2f..1419bdeaa09247871890a84f681673234cfb0957 100644
--- a/bindings/rust/libgpiod/src/request_config.rs
+++ b/bindings/rust/libgpiod/src/request_config.rs
@@ -6,7 +6,7 @@ use std::ffi::{CStr, CString};
use std::os::raw::c_char;
use std::str;
-use super::{gpiod, Error, OperationType, Result};
+use super::{Error, OperationType, Result, gpiod};
/// Request configuration objects
///
diff --git a/bindings/rust/libgpiod/tests/chip.rs b/bindings/rust/libgpiod/tests/chip.rs
index 60b4ecc431fce15f69e20fbad1ed40df7280f172..1fbe2b7089dc0ce90eb259aff9a0771b0718fb67 100644
--- a/bindings/rust/libgpiod/tests/chip.rs
+++ b/bindings/rust/libgpiod/tests/chip.rs
@@ -9,7 +9,7 @@ mod chip {
use std::path::PathBuf;
use gpiosim_sys::Sim;
- use libgpiod::{chip::Chip, Error as ChipError, OperationType};
+ use libgpiod::{Error as ChipError, OperationType, chip::Chip};
mod open {
use super::*;
diff --git a/bindings/rust/libgpiod/tests/common/config.rs b/bindings/rust/libgpiod/tests/common/config.rs
index 7bb1f659a92831ba3585f4e06b8fe6031d2243dc..d876df7f91ca0b86a03dda10bead7f9285043c10 100644
--- a/bindings/rust/libgpiod/tests/common/config.rs
+++ b/bindings/rust/libgpiod/tests/common/config.rs
@@ -7,9 +7,10 @@ use std::time::Duration;
use gpiosim_sys::{Pull, Sim, Value as SimValue};
use libgpiod::{
+ Result,
chip::Chip,
line::{self, Bias, Direction, Drive, Edge, EventClock, Offset, SettingVal, Value},
- request, Result,
+ request,
};
pub(crate) struct TestConfig {
diff --git a/bindings/rust/libgpiod/tests/edge_event.rs b/bindings/rust/libgpiod/tests/edge_event.rs
index 03b7e7cb05f7564170a27ba1cef0cb3892e6945f..a592f1db94bd6f3f7d06003c4cd9b7878c5a3b33 100644
--- a/bindings/rust/libgpiod/tests/edge_event.rs
+++ b/bindings/rust/libgpiod/tests/edge_event.rs
@@ -87,10 +87,12 @@ mod edge_event {
trigger_falling_and_rising_edge(config.sim(), GPIO);
// Rising event
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let mut events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 1);
@@ -101,10 +103,12 @@ mod edge_event {
assert_eq!(event.line_offset(), GPIO);
// Falling event
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let mut events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 1);
@@ -115,10 +119,12 @@ mod edge_event {
assert_eq!(event.line_offset(), GPIO);
// No events available
- assert!(!config
- .request()
- .wait_edge_events(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !config
+ .request()
+ .wait_edge_events(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
assert!(ts_falling > ts_rising);
}
@@ -136,10 +142,12 @@ mod edge_event {
trigger_falling_and_rising_edge(config.sim(), GPIO);
// Rising event
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let mut events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 1);
@@ -149,10 +157,12 @@ mod edge_event {
assert_eq!(event.line_offset(), GPIO);
// No events available
- assert!(!config
- .request()
- .wait_edge_events(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !config
+ .request()
+ .wait_edge_events(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
}
#[test]
@@ -168,10 +178,12 @@ mod edge_event {
trigger_falling_and_rising_edge(config.sim(), GPIO);
// Falling event
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let mut events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 1);
@@ -181,10 +193,12 @@ mod edge_event {
assert_eq!(event.line_offset(), GPIO);
// No events available
- assert!(!config
- .request()
- .wait_edge_events(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !config
+ .request()
+ .wait_edge_events(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
}
#[test]
@@ -200,10 +214,12 @@ mod edge_event {
// Rising event GPIO 0
let mut buf = request::Buffer::new(0).unwrap();
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let mut events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 1);
@@ -215,10 +231,12 @@ mod edge_event {
assert_eq!(event.line_seqno(), 1);
// Rising event GPIO 1
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let mut events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 1);
@@ -230,10 +248,12 @@ mod edge_event {
assert_eq!(event.line_seqno(), 1);
// No events available
- assert!(!config
- .request()
- .wait_edge_events(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !config
+ .request()
+ .wait_edge_events(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
}
#[test]
@@ -249,10 +269,12 @@ mod edge_event {
trigger_multiple_events(config.sim(), GPIO);
// Read multiple events
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 3);
@@ -285,10 +307,12 @@ mod edge_event {
trigger_multiple_events(config.sim(), GPIO);
// Read multiple events
- assert!(config
- .request()
- .wait_edge_events(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ config
+ .request()
+ .wait_edge_events(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let events = config.request().read_edge_events(&mut buf).unwrap();
assert_eq!(events.len(), 2);
diff --git a/bindings/rust/libgpiod/tests/info_event.rs b/bindings/rust/libgpiod/tests/info_event.rs
index c969af78238374110bfdb5536b4cab771d977c15..83e465b3a3ce0f256f90fd60d6ecf225e462c208 100644
--- a/bindings/rust/libgpiod/tests/info_event.rs
+++ b/bindings/rust/libgpiod/tests/info_event.rs
@@ -8,8 +8,8 @@ mod info_event {
use libc::EINVAL;
use std::{
sync::{
- mpsc::{self, Receiver, Sender},
Arc, Mutex,
+ mpsc::{self, Receiver, Sender},
},
thread,
time::Duration,
@@ -17,9 +17,10 @@ mod info_event {
use gpiosim_sys::Sim;
use libgpiod::{
+ Error as ChipError, OperationType,
chip::Chip,
line::{self, Direction, InfoChangeKind, Offset},
- request, Error as ChipError, OperationType,
+ request,
};
fn request_reconfigure_line(chip: Arc<Mutex<Chip>>, tx: Sender<()>, rx: Receiver<()>) {
@@ -75,9 +76,11 @@ mod info_event {
assert_eq!(info.offset(), GPIO);
// No events available
- assert!(!chip
- .wait_info_event(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !chip
+ .wait_info_event(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
}
#[test]
@@ -99,11 +102,12 @@ mod info_event {
rx_main.recv().expect("Could not receive from channel");
// Line requested event
- assert!(chip
- .lock()
- .unwrap()
- .wait_info_event(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ chip.lock()
+ .unwrap()
+ .wait_info_event(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let event = chip.lock().unwrap().read_info_event().unwrap();
let ts_req = event.timestamp();
@@ -120,11 +124,12 @@ mod info_event {
rx_main.recv().expect("Could not receive from channel");
// Line changed event
- assert!(chip
- .lock()
- .unwrap()
- .wait_info_event(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ chip.lock()
+ .unwrap()
+ .wait_info_event(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let event = chip.lock().unwrap().read_info_event().unwrap();
let ts_rec = event.timestamp();
@@ -141,22 +146,25 @@ mod info_event {
tx_main.send(()).expect("Could not send signal on channel");
// Line released event
- assert!(chip
- .lock()
- .unwrap()
- .wait_info_event(Some(Duration::from_secs(1)))
- .unwrap());
+ assert!(
+ chip.lock()
+ .unwrap()
+ .wait_info_event(Some(Duration::from_secs(1)))
+ .unwrap()
+ );
let event = chip.lock().unwrap().read_info_event().unwrap();
let ts_rel = event.timestamp();
assert_eq!(event.event_type().unwrap(), InfoChangeKind::LineReleased);
// No events available
- assert!(!chip
- .lock()
- .unwrap()
- .wait_info_event(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !chip
+ .lock()
+ .unwrap()
+ .wait_info_event(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
// Check timestamps are really monotonic.
assert!(ts_rel > ts_rec);
diff --git a/bindings/rust/libgpiod/tests/line_info.rs b/bindings/rust/libgpiod/tests/line_info.rs
index d02c9eaf576c5d7468ab90058c2cbe166cbdf641..85714eb7c65d0b319acca96c223d8d52b0f651e0 100644
--- a/bindings/rust/libgpiod/tests/line_info.rs
+++ b/bindings/rust/libgpiod/tests/line_info.rs
@@ -11,9 +11,9 @@ mod line_info {
use crate::common::*;
use gpiosim_sys::{Direction as SimDirection, Sim};
use libgpiod::{
+ Error as ChipError, OperationType,
chip::Chip,
line::{Bias, Direction, Drive, Edge, EventClock},
- Error as ChipError, OperationType,
};
const NGPIO: usize = 8;
diff --git a/bindings/rust/libgpiod/tests/line_request.rs b/bindings/rust/libgpiod/tests/line_request.rs
index 4ba0d18b0f635eeab4fba99a6bcf38db0bca9289..07b0987c6204b9b10ec71948438bc67b43ff97ee 100644
--- a/bindings/rust/libgpiod/tests/line_request.rs
+++ b/bindings/rust/libgpiod/tests/line_request.rs
@@ -11,10 +11,10 @@ mod line_request {
use crate::common::*;
use gpiosim_sys::{Pull, Value as SimValue};
use libgpiod::{
+ Error as ChipError, OperationType,
line::{
self, Bias, Direction, Drive, Edge, EventClock, Offset, SettingVal, Value, ValueMap,
},
- Error as ChipError, OperationType,
};
const NGPIO: usize = 8;
@@ -246,10 +246,12 @@ mod line_request {
config.request_lines().unwrap();
// No events available
- assert!(!config
- .request()
- .wait_edge_events(Some(Duration::from_millis(100)))
- .unwrap());
+ assert!(
+ !config
+ .request()
+ .wait_edge_events(Some(Duration::from_millis(100)))
+ .unwrap()
+ );
}
}
diff --git a/bindings/rust/libgpiod/tests/request_config.rs b/bindings/rust/libgpiod/tests/request_config.rs
index a925a6833105c85fc6016253ae449a4fe2e8da06..5eba3e179f5a73c3122a7d04b790cca0164a45cb 100644
--- a/bindings/rust/libgpiod/tests/request_config.rs
+++ b/bindings/rust/libgpiod/tests/request_config.rs
@@ -5,7 +5,7 @@
mod common;
mod request_config {
- use libgpiod::{request, Error as ChipError, OperationType};
+ use libgpiod::{Error as ChipError, OperationType, request};
mod verify {
use super::*;
--
2.48.1
next prev parent reply other threads:[~2025-09-26 14:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-26 14:35 [PATCH libgpiod 0/3] bindings: rust: pre-release tweaks Bartosz Golaszewski
2025-09-26 14:35 ` [PATCH libgpiod 1/3] bindings: rust: complete the unification of exports in examples Bartosz Golaszewski
2025-09-29 6:21 ` Erik Schilling
2025-09-29 7:29 ` Bartosz Golaszewski
2025-09-26 14:35 ` Bartosz Golaszewski [this message]
2025-09-26 14:35 ` [PATCH libgpiod 3/3] bindings: rust: add examples to the README.md in the libgpiod crate Bartosz Golaszewski
2025-09-29 6:21 ` [PATCH libgpiod 0/3] bindings: rust: pre-release tweaks Erik Schilling
2025-09-29 7:34 ` Viresh Kumar
2025-09-30 7:54 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250926-rust-release-tweaks-v1-2-beae932eb691@linaro.org \
--to=brgl@bgdev.pl \
--cc=bartosz.golaszewski@linaro.org \
--cc=erik@riscstar.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).