Skip to content

Commit e705c0e

Browse files
committed
Fixed source format.
1 parent 6bed684 commit e705c0e

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.rustfmt.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# .rustfmt.toml
22
#
3-
# Code format definitions for Eclipse Paho MQTT Rust library.
3+
# Code format definitions for the Rust Linux 'indistrial-io' crate.
44
#
55

6-
edition = "2018"
6+
edition = "2021"
77

8-
# As of 2021-04-23, this is still unstable, requiring +nightly
8+
# As of 2025-05-23, this is still unstable, requiring +nightly
99
control_brace_style = "ClosingNextLine"
1010

src/channel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ impl DataFormat {
148148
8 => Some(TypeId::of::<i64>()),
149149
_ => None,
150150
}
151-
} else {
151+
}
152+
else {
152153
match nbytes {
153154
1 => Some(TypeId::of::<u8>()),
154155
2 => Some(TypeId::of::<u16>()),

src/context.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,12 @@ impl Context {
356356
let mut pname: *const c_char = ptr::null();
357357
let mut pval: *const c_char = ptr::null();
358358

359-
sys_result(unsafe {
360-
ffi::iio_context_get_attr(self.inner.ctx, idx as c_uint, &mut pname, &mut pval)
361-
}, ())?;
359+
sys_result(
360+
unsafe {
361+
ffi::iio_context_get_attr(self.inner.ctx, idx as c_uint, &mut pname, &mut pval)
362+
},
363+
(),
364+
)?;
362365
let name = cstring_opt(pname);
363366
let val = cstring_opt(pval);
364367
if name.is_none() || val.is_none() {

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn cstring_opt(pstr: *const c_char) -> Option<String> {
109109
pub(crate) fn sys_result<T>(ret: i32, result: T) -> Result<T> {
110110
match ret {
111111
ret if ret < 0 => Err(Errno::from_raw(-ret).into()),
112-
_ => Ok(result)
112+
_ => Ok(result),
113113
}
114114
}
115115

@@ -269,7 +269,7 @@ mod tests {
269269
#[test]
270270
fn test_sys_result() {
271271
assert!(matches!(sys_result(-1, "hello"), Err(_)));
272-
assert!(matches!(sys_result( 1, "hello"), Ok("hello")));
272+
assert!(matches!(sys_result(1, "hello"), Ok("hello")));
273273
}
274274

275275
#[test]

0 commit comments

Comments
 (0)