Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary bounds #59

Merged
merged 3 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/load/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use stats::Stats;
pub use status::{RequestStatusProvider, Status, StatusUpdaterThread};

pub fn start_sync(
request_generator: impl RequestGenerator + Clone + Send + Sized + 'static,
request_generator: impl RequestGenerator + Send + Sized + 'static,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Sized is unnecessary here as well, use of the type in the by-value parameter implies Sized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stylistically, this is a better case for old-school generic parameters and a where clause.

config: Configuration,
title: &str,
) -> Stats {
Expand Down Expand Up @@ -110,7 +110,7 @@ pub fn start_background_async(

pub fn start_async(
request_generator: impl RequestGenerator + Send + Sized + 'static,
status_provider: impl RequestStatusProvider + Send + Sized + Sync + 'static,
status_provider: impl RequestStatusProvider + Send + 'static,
config: Configuration,
title: &str,
) -> Stats {
Expand Down Expand Up @@ -146,7 +146,7 @@ pub fn start_async(
}

fn get_threads(
request_generator: &Arc<Mutex<impl RequestGenerator + Send + Sized + 'static>>,
request_generator: &Arc<Mutex<impl RequestGenerator + Send + 'static>>,
config: &Configuration,
request_mode_run: RequestSendMode,
responses: &Arc<Mutex<Vec<Response>>>,
Expand Down Expand Up @@ -182,7 +182,7 @@ fn per_thread_strategy(
responses: &Arc<Mutex<Vec<Response>>>,
config: &Configuration,
request_mode_run: RequestSendMode,
request_generator: &Arc<Mutex<impl RequestGenerator + Send + Sized + 'static>>,
request_generator: &Arc<Mutex<impl RequestGenerator + Send + 'static>>,
) -> Vec<JoinHandle<()>> {
let mut child_threads = Vec::new();
for _ in 0..config.thread_no() {
Expand All @@ -207,7 +207,7 @@ fn duration_strategy(
responses: &Arc<Mutex<Vec<Response>>>,
config: &Configuration,
request_mode_run: RequestSendMode,
request_generator: &Arc<Mutex<impl RequestGenerator + Send + Sized + 'static>>,
request_generator: &Arc<Mutex<impl RequestGenerator + Send + 'static>>,
) -> Vec<JoinHandle<()>> {
let mut child_threads = Vec::new();
for _ in 0..config.thread_no() {
Expand Down
6 changes: 2 additions & 4 deletions src/load/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub trait RequestStatusProvider {

fn update_statuses(
responses_clone: &Arc<Mutex<Vec<Response>>>,
request_status_provider: &Arc<Mutex<impl RequestStatusProvider + Send + Sized + Sync>>,
request_status_provider: &Arc<Mutex<impl RequestStatusProvider + Send>>,
) -> Vec<Status> {
let responses = &mut *responses_clone.lock().unwrap();
let ids: Vec<Id> = responses
Expand All @@ -118,9 +118,7 @@ fn update_statuses(
impl StatusUpdaterThread {
pub fn spawn(
responses: &Arc<Mutex<Vec<Response>>>,
request_status_provider: &Arc<
Mutex<impl RequestStatusProvider + Send + Sized + Sync + 'static>,
>,
request_status_provider: &Arc<Mutex<impl RequestStatusProvider + Send + 'static>>,
monitor: Monitor,
title: &str,
shutdown_grace_period: u32,
Expand Down