From a417fad9e8a675590c89f3f63c8a4d5cc097663d Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Mon, 3 Nov 2025 21:19:05 +0100 Subject: [PATCH 1/2] Fix clippy lints --- src/master.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/master.rs b/src/master.rs index 15c7c83..73b56db 100644 --- a/src/master.rs +++ b/src/master.rs @@ -81,7 +81,7 @@ impl Master { Ok((ioctl!(self, ec::ioctl::CREATE_DOMAIN)? as usize).into()) } - pub const fn domain(&self, idx: DomainIdx) -> Domain { + pub const fn domain(&self, idx: DomainIdx) -> Domain<'_> { Domain::new(idx, self) } @@ -265,7 +265,7 @@ impl Master { }) } - pub fn configure_slave(&mut self, addr: SlaveAddr, expected: SlaveId) -> Result { + pub fn configure_slave(&mut self, addr: SlaveAddr, expected: SlaveId) -> Result> { log::debug!("Configure slave {:?}", addr); let mut data = ec::ec_ioctl_config_t::default(); let (alias, pos) = addr.as_pair(); From 56518f862ef9ed5356ce5074e97c88b773dd6774 Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Mon, 3 Nov 2025 21:24:22 +0100 Subject: [PATCH 2/2] Run CI with Rust 1.71 --- .github/workflows/build.yml | 2 +- Cargo.toml | 1 + README.md | 2 +- examples/cyclic-data.rs | 3 +-- examples/foe-read.rs | 5 ++--- examples/foe-write.rs | 5 ++--- src/master.rs | 6 +++++- src/types.rs | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0f3412..217f057 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: strategy: matrix: toolchain: - - 1.63.0 + - 1.71.0 - stable - nightly env: diff --git a/Cargo.toml b/Cargo.toml index e26c616..911e697 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/ethercat-rs/ethercat" readme = "README.md" license = "MIT/Apache-2.0" edition = "2018" +rust-version = "1.71" [dependencies] derive-new = "0.5" diff --git a/README.md b/README.md index 06eefd7..17586e2 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Bindings have been pregenerated for the tag `1.6.1` - if you activate the feature `pregenerated-bindings`, you don't need the master code to build, but the kernel modules must match that revision. -The minimum tested Rust version is 1.63.0. +The minimum tested Rust version is 1.71.0. # Licensing diff --git a/examples/cyclic-data.rs b/examples/cyclic-data.rs index 9cb550f..d1cb297 100644 --- a/examples/cyclic-data.rs +++ b/examples/cyclic-data.rs @@ -155,8 +155,7 @@ pub fn init_master( let cfg_info = master.get_config_info(cfg_index)?; log::info!("Config info: {:#?}", cfg_info); if cfg_info.slave_position.is_none() { - return Err(io::Error::new( - io::ErrorKind::Other, + return Err(io::Error::other( "Unable to configure slave", )); } diff --git a/examples/foe-read.rs b/examples/foe-read.rs index e7a1fb2..95144a6 100644 --- a/examples/foe-read.rs +++ b/examples/foe-read.rs @@ -6,14 +6,13 @@ fn main() -> Result<(), std::io::Error> { let args: Vec = std::env::args().collect(); if args.len() < 3 { eprintln!("Usage: foe-read "); - return Err(std::io::Error::new( - std::io::ErrorKind::Other, + return Err(std::io::Error::other( "Not enough arguments", )); } let slave_idx: ethercat::SlavePos = args[1] .parse::() - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))? + .map_err(std::io::Error::other)? .into(); let foe_name = &args[2]; let res = master.foe_read(slave_idx, foe_name)?; diff --git a/examples/foe-write.rs b/examples/foe-write.rs index 38b608e..5e80d4c 100644 --- a/examples/foe-write.rs +++ b/examples/foe-write.rs @@ -6,14 +6,13 @@ fn main() -> Result<(), std::io::Error> { let args: Vec = std::env::args().collect(); if args.len() < 4 { eprintln!("Usage: foe-read "); - return Err(std::io::Error::new( - std::io::ErrorKind::Other, + return Err(std::io::Error::other( "Not enough arguments", )); } let slave_idx = args[1] .parse::() - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))? + .map_err(std::io::Error::other)? .into(); let foe_name = &args[2]; let file = &args[3]; diff --git a/src/master.rs b/src/master.rs index 73b56db..191ee93 100644 --- a/src/master.rs +++ b/src/master.rs @@ -265,7 +265,11 @@ impl Master { }) } - pub fn configure_slave(&mut self, addr: SlaveAddr, expected: SlaveId) -> Result> { + pub fn configure_slave( + &mut self, + addr: SlaveAddr, + expected: SlaveId, + ) -> Result> { log::debug!("Configure slave {:?}", addr); let mut data = ec::ec_ioctl_config_t::default(); let (alias, pos) = addr.as_pair(); diff --git a/src/types.rs b/src/types.rs index c19c092..74f686c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -30,7 +30,7 @@ pub enum Error { impl From for io::Error { fn from(e: Error) -> Self { - io::Error::new(io::ErrorKind::Other, e) + io::Error::other(e) } }