Skip to content

Commit

Permalink
Pre-commit fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed May 2, 2024
1 parent dcb68d7 commit b27a289
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
1 change: 1 addition & 0 deletions ci/nostd-check/src/bin/nostd_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![no_std]

use core::panic::PanicInfo;

use getrandom::{register_custom_getrandom, Error};
use linked_list_allocator::LockedHeap;
#[allow(unused_imports)]
Expand Down
4 changes: 2 additions & 2 deletions ci/valgrind-check/src/pub_sub/bin/z_pub_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use std::time::Duration;
use zenoh::config::Config;
use zenoh::prelude::*;

use zenoh::{config::Config, prelude::*};

#[tokio::main]
async fn main() {
Expand Down
7 changes: 3 additions & 4 deletions ci/valgrind-check/src/queryable_get/bin/z_queryable_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use std::convert::TryFrom;
use std::time::Duration;
use zenoh::config::Config;
use zenoh::prelude::*;
use std::{convert::TryFrom, time::Duration};

use zenoh::{config::Config, prelude::*};

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-shm/src/header/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use lazy_static::lazy_static;
use std::{
collections::LinkedList,
sync::{Arc, Mutex},
};

use lazy_static::lazy_static;
use zenoh_result::{zerror, ZResult};

use super::{
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-shm/src/header/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use lazy_static::lazy_static;
use std::{
collections::BTreeMap,
sync::{Arc, Mutex},
};

use lazy_static::lazy_static;
use zenoh_result::{zerror, ZResult};

use super::{
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-shm/src/posix_shm/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
unsafe { *(self.shmem.as_ptr() as *mut usize) }
}

// TODO: dead code warning occurs because of `tested_crate_module!()` macro when feature `test` is not enabled. Better to fix that
// TODO: dead code warning occurs because of `tested_crate_module!()` macro when feature `test` is not enabled. Better to fix that
#[allow(dead_code)]
pub fn is_empty(&self) -> bool {
unsafe { *(self.shmem.as_ptr() as *mut usize) == 0 }
Expand Down
4 changes: 2 additions & 2 deletions commons/zenoh-shm/src/watchdog/confirmator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use lazy_static::lazy_static;
use zenoh_result::{zerror, ZResult};

use super::{
periodic_task::PeriodicTask,
descriptor::{Descriptor, OwnedDescriptor, SegmentID},
periodic_task::PeriodicTask,
segment::Segment,
};

Expand Down Expand Up @@ -117,7 +117,7 @@ pub struct WatchdogConfirmator {
impl WatchdogConfirmator {
fn new(interval: Duration) -> Self {
let segment_transactions = Arc::<lockfree::queue::Queue<Arc<ConfirmedSegment>>>::default();

let c_segment_transactions = segment_transactions.clone();
let mut segments: Vec<(Arc<ConfirmedSegment>, BTreeMap<OwnedDescriptor, i32>)> = vec![];
let task = PeriodicTask::new("Watchdog Confirmator".to_owned(), interval, move || {
Expand Down
9 changes: 5 additions & 4 deletions commons/zenoh-shm/src/watchdog/periodic_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use std::{
use thread_priority::ThreadBuilder;
#[cfg(unix)]
use thread_priority::{
set_current_thread_priority, RealtimeThreadSchedulePolicy, ThreadPriority, ThreadPriorityValue, ThreadSchedulePolicy::Realtime
set_current_thread_priority, RealtimeThreadSchedulePolicy, ThreadPriority, ThreadPriorityValue,
ThreadSchedulePolicy::Realtime,
};

pub struct PeriodicTask {
Expand All @@ -44,7 +45,7 @@ impl PeriodicTask {
let running = Arc::new(AtomicBool::new(true));

let c_running = running.clone();

#[cfg(unix)]
let builder = ThreadBuilder::default()
.name(name)
Expand All @@ -54,7 +55,7 @@ impl PeriodicTask {
// TODO: deal with windows realtime scheduling
#[cfg(windows)]
let builder = ThreadBuilder::default().name(name);

let _ = builder.spawn(move |result| {
if let Err(e) = result {
#[cfg(windows)]
Expand All @@ -79,7 +80,7 @@ impl PeriodicTask {
let cycle_start = std::time::Instant::now();

f();

// sleep for next iteration
let elapsed = cycle_start.elapsed();
if elapsed < interval {
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-shm/src/watchdog/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use lazy_static::lazy_static;
use std::{
collections::BTreeSet,
sync::{Arc, Mutex},
};

use lazy_static::lazy_static;
use zenoh_result::{zerror, ZResult};

use super::{allocated_watchdog::AllocatedWatchdog, descriptor::OwnedDescriptor, segment::Segment};
Expand Down
11 changes: 5 additions & 6 deletions io/zenoh-transport/src/unicast/universal/reliability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use std::convert::TryInto;
use std::fmt;

use super::common::seq_num::SeqNum;
use super::core::u64;
use std::{convert::TryInto, fmt};

use zenoh_result::{ZError, ZErrorKind, ZResult};
use zenoh_util::zerror;

use super::{common::seq_num::SeqNum, core::u64};

pub(super) struct ReliabilityQueue<T> {
sn: SeqNum,
index: usize,
Expand Down Expand Up @@ -249,9 +247,10 @@ impl<T: fmt::Debug> fmt::Debug for ReliabilityQueue<T> {

#[cfg(test)]
mod tests {
use super::*;
use rand::{thread_rng, Rng};

use super::*;

#[test]
fn reliability_queue_simple() {
let size = 2;
Expand Down

0 comments on commit b27a289

Please sign in to comment.