Skip to content

Commit a4fead7

Browse files
authored
Make sure rustup is updated on the CI (and support 1.87 :) ) (#1948)
* Update ci.yml * Fix clippy errors * more clippy * ignore extremely large error for config deserializer * more clippy fixes
1 parent 53cb350 commit a4fead7

File tree

8 files changed

+15
-18
lines changed

8 files changed

+15
-18
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ jobs:
9090
- name: Update Stable Rust toolchain
9191
run: rustup update stable
9292

93+
- name: Make sure necessary tools are installed
94+
run: rustup component add clippy rustfmt
95+
9396
- name: Setup rust-cache
9497
uses: Swatinem/rust-cache@v2
9598
with:

commons/zenoh-buffers/src/zbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ impl io::Seek for ZBufReader<'_> {
407407
.take(self.cursor.slice)
408408
.fold(0, |acc, s| acc + s.len())
409409
+ self.cursor.byte;
410-
let current_pos = i64::try_from(current_pos)
411-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?;
410+
let current_pos =
411+
i64::try_from(current_pos).map_err(|e| std::io::Error::other(e.to_string()))?;
412412

413413
let offset = match pos {
414414
std::io::SeekFrom::Start(s) => i64::try_from(s).unwrap_or(i64::MAX) - current_pos,

commons/zenoh-macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub fn rustc_version_release(_tokens: TokenStream) -> TokenStream {
6060
}
6161

6262
/// An enumeration of items which can be annotated with `#[zenoh_macros::unstable_doc]`, #[zenoh_macros::unstable]`, `#[zenoh_macros::internal]`
63+
#[allow(clippy::large_enum_variant)]
6364
enum AnnotableItem {
6465
/// Wrapper around [`syn::Item`].
6566
Item(Item),

commons/zenoh-sync/src/condition.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,11 @@ pub type ConditionWaiter = Pin<Box<EventListener>>;
2323
/// not be race condition on [notify_one](Condition::notify_one) or
2424
/// [notify_all](Condition::notify_all).
2525
///
26+
#[derive(Default)]
2627
pub struct Condition {
2728
event: Event,
2829
}
2930

30-
impl Default for Condition {
31-
fn default() -> Condition {
32-
Condition {
33-
event: Event::new(),
34-
}
35-
}
36-
}
37-
3831
impl Condition {
3932
/// Creates a new condition variable with a given capacity.
4033
/// The capacity indicates the maximum number of tasks that

commons/zenoh-util/tests/zresult.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn error_with_source() {
4545
panic!();
4646
}
4747

48-
let ioerr = std::io::Error::new(std::io::ErrorKind::Other, "IOERR");
48+
let ioerr = std::io::Error::other("IOERR");
4949
let e = zerror!( ioerr =>"ERR2");
5050
let s = e.to_string();
5151
println!("{e}");

io/zenoh-links/zenoh-link-quic/src/unicast.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,8 @@ impl LinkManagerUnicastTrait for LinkManagerUnicastQuic {
289289

290290
let mut quic_endpoint = {
291291
// create the Endpoint with this socket
292-
let runtime = quinn::default_runtime().ok_or_else(|| {
293-
std::io::Error::new(std::io::ErrorKind::Other, "no async runtime found")
294-
})?;
292+
let runtime = quinn::default_runtime()
293+
.ok_or_else(|| std::io::Error::other("no async runtime found"))?;
295294
ZResult::Ok(quinn::Endpoint::new_with_abstract_socket(
296295
EndpointConfig::default(),
297296
None,
@@ -410,9 +409,8 @@ impl LinkManagerUnicastTrait for LinkManagerUnicastQuic {
410409
zenoh_util::net::set_bind_to_device_udp_socket(&socket, iface)?;
411410

412411
// create the Endpoint with this socket
413-
let runtime = quinn::default_runtime().ok_or_else(|| {
414-
std::io::Error::new(std::io::ErrorKind::Other, "no async runtime found")
415-
})?;
412+
let runtime = quinn::default_runtime()
413+
.ok_or_else(|| std::io::Error::other("no async runtime found"))?;
416414
ZResult::Ok(quinn::Endpoint::new_with_abstract_socket(
417415
EndpointConfig::default(),
418416
Some(server_config),

zenoh/src/api/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ impl Config {
130130
// REVIEW(fuzzypixelz): the error variant of the Result is a Result because this does
131131
// deserialization AND validation.
132132
#[zenoh_macros::unstable]
133+
// TODO(yellowhatter): clippy says that Error here is extremely large (1k)
134+
#[allow(clippy::result_large_err)]
133135
pub fn from_deserializer<'d, D: serde::Deserializer<'d>>(
134136
d: D,
135137
) -> Result<Self, Result<Self, D::Error>>

zenoh/src/net/runtime/orchestrator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ impl Runtime {
11411141
tracing::debug!("Waiting for UDP datagram...");
11421142
loop {
11431143
let (n, peer) = mcast_socket.recv_from(&mut buf).await.unwrap();
1144-
if local_addrs.iter().any(|addr| *addr == peer) {
1144+
if local_addrs.contains(&peer) {
11451145
tracing::trace!("Ignore UDP datagram from own socket");
11461146
continue;
11471147
}

0 commit comments

Comments
 (0)