Skip to content

Commit

Permalink
fix dependencies and compilations warnings
Browse files Browse the repository at this point in the history
This commit moves all dependencies that don't go into the final library
functions to `[dev-dependencies]` in `Cargo.toml`. Like this, we don't
polute users of our library with dependencies they don't need. This has
great benefits also in terms of compilation speed. I also went ahead and
updated our dependencies.

Also, I added a `.gitignore` and a `rust-toolchain.toml`. The second is
extremelly important since this crate only compiles with the nightly
toolchain.

Finally, this commit fixes some warnings the rustc was giving when
trying to compile the crate.
  • Loading branch information
LGFae committed Jan 25, 2023
1 parent b05a591 commit 319ddf4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cargo.lock
target
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ authors = ["Ricardo Pieper <[email protected]>"]
edition = "2021"

[dependencies]
rand = "0.6.5"
lazy_static = "1.3.0"
raster = "0.2.0"
clap = "2.33.0"
num_cpus = "1.0"
rayon = "1.6.0"
time = "0.1.42"
futures = "0.3"
tokio = { version = "1", features = ["full"] }
tokio-stream = "0.1"
parking_lot = "0.12"

[dev-dependencies]
criterion = "0.3"
rayon = "1.6"
clap = "2.34"
raster = "0.2"
tokio = { version = "1.24", features = ["full"] }
tokio-stream = "0.1"
rand = "0.6"
lazy_static = "1.4"
num_cpus = "1.15"
time = "0.3"
futures = "0.3"

[[bench]]
name = "mandelbrot_rustspp"
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly" # this is necessary for cargo-expand to work
6 changes: 2 additions & 4 deletions src/blocks/in_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use crate::*;
use parking_lot::Mutex;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread;
use std::thread::JoinHandle;
use work_storage::{BlockingOrderedSet, BlockingQueue};
use work_storage::{TimestampedWorkItem, WorkItem};

Expand Down Expand Up @@ -106,7 +104,7 @@ impl<
let collected = handler.process(val, order);
(*collected_list).push(collected);
}
TimestampedWorkItem(WorkItem::Dropped, order) => (),
TimestampedWorkItem(WorkItem::Dropped, _order) => (),
TimestampedWorkItem(WorkItem::Stop, _) => {
break;
}
Expand Down Expand Up @@ -134,7 +132,7 @@ impl<
let collected: TCollected = handler.process(val, order);
(*collected_list).push(collected);
}
TimestampedWorkItem(WorkItem::Dropped, order) => {
TimestampedWorkItem(WorkItem::Dropped, _order) => {
next_item += 1;
}
TimestampedWorkItem(WorkItem::Stop, _) => {
Expand Down
18 changes: 8 additions & 10 deletions src/blocks/inout_block.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::blocks::*;
use crate::work_storage::*;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;
use std::thread::JoinHandle;
use std::{marker::PhantomData, sync::Arc};

// Public API: A Input-Output node; transforms some value into another
Expand Down Expand Up @@ -80,12 +78,12 @@ impl<
}

impl<
TInput: 'static + Send,
TOutput: 'static,
TCollected: 'static,
TStage: InOut<TInput, TOutput> + Send + 'static,
TFactory: FnMut() -> TStage,
TNextStep: PipelineBlock<TOutput, TCollected> + Send + Sync + 'static,
TInput: 'static + Send,
TOutput: 'static,
TCollected: 'static,
TStage: InOut<TInput, TOutput> + Send + 'static,
TFactory: FnMut() -> TStage,
TNextStep: PipelineBlock<TOutput, TCollected> + Send + Sync + 'static,
> InOutBlock<TInput, TOutput, TCollected, TStage, TFactory, TNextStep>
{
pub fn new(
Expand All @@ -110,7 +108,7 @@ impl<
work_queue: BlockingQueue::new(),
next_step: Arc::new(next_step),
transformer_factory: transformer,
replicas: replicas,
replicas,
_params: PhantomData,
}
}
Expand All @@ -123,7 +121,7 @@ impl<
let queue = self.work_queue.clone();
let alive_threads = alive_threads.clone();

let mut next_step = self.next_step.clone();
let next_step = self.next_step.clone();
let mut transformer = (self.transformer_factory)();

let monitor_loop = MonitorLoop::new(move || {
Expand Down

0 comments on commit 319ddf4

Please sign in to comment.