Skip to content

Commit

Permalink
test(lint): fix code style based on linter report
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed May 23, 2024
1 parent 53c7c67 commit 7fc6f71
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 38 deletions.
5 changes: 0 additions & 5 deletions examples/presence_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ struct State {
is_doing: String,
flag: bool,
}
#[derive(Debug, serde::Serialize)]
struct State2 {
is_doing: String,
business: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn snafu::Error>> {
Expand Down
22 changes: 0 additions & 22 deletions src/core/event_engine/effect_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ where
mod should {
use super::*;
use crate::core::event_engine::Event;
use std::future::Future;

struct TestEvent;

Expand Down Expand Up @@ -261,27 +260,6 @@ mod should {
}
}

#[derive(Clone)]
struct TestRuntime {}

#[async_trait::async_trait]
impl Runtime for TestRuntime {
fn spawn<R>(&self, _future: impl Future<Output = R> + Send + 'static)
where
R: Send + 'static,
{
// Do nothing.
}

async fn sleep(self, _delay: u64) {
// Do nothing.
}

async fn sleep_microseconds(self, _delay: u64) {
// Do nothing.
}
}

#[test]
fn create_not_managed_effect() {
let (_tx, rx) = async_channel::bounded::<TestInvocation>(5);
Expand Down
4 changes: 1 addition & 3 deletions src/core/retry_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ impl RequestRetryConfiguration {
/// * `Some(delay_in_microseconds)` - The delay in microseconds.
/// * `None` - If `delay_in_seconds` is `None`.
fn delay_in_microseconds(delay_in_seconds: Option<u64>) -> Option<u64> {
let Some(delay_in_seconds) = delay_in_seconds else {
return None;
};
let delay_in_seconds = delay_in_seconds?;

const MICROS_IN_SECOND: u64 = 1_000_000;
let delay = delay_in_seconds * MICROS_IN_SECOND;
Expand Down
4 changes: 2 additions & 2 deletions src/dx/access/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ mod it_should {
response: None,
request_handler: Some(Box::new(|req| {
assert!(req.query_parameters.contains_key("timestamp"));
assert!(req.query_parameters.get("timestamp").is_some());
assert!(req.query_parameters.contains_key("timestamp"));
})),
};

Expand All @@ -368,7 +368,7 @@ mod it_should {
response: None,
request_handler: Some(Box::new(|req| {
assert!(req.query_parameters.contains_key("signature"));
assert!(req.query_parameters.get("signature").is_some());
assert!(req.query_parameters.contains_key("signature"));
assert!(req
.query_parameters
.get("signature")
Expand Down
2 changes: 1 addition & 1 deletion src/dx/presence/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ mod it_should {
response: None,
request_handler: Some(Box::new(|req| {
assert!(req.query_parameters.contains_key("state"));
assert!(req.query_parameters.get("state").is_some());
assert!(req.query_parameters.contains_key("state"));

let state = req.query_parameters.get("state").unwrap();
assert!(state.contains("channel_a"));
Expand Down
2 changes: 1 addition & 1 deletion src/dx/subscribe/event_engine/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl SubscribeState {
// Merge stored cursor with service-provided.
let mut next_cursor = next_cursor.clone();
if let Some(cursor) = cursor {
next_cursor.timetoken = cursor.timetoken.clone();
next_cursor.timetoken.clone_from(&cursor.timetoken);
}

Some(self.transition_to(
Expand Down
2 changes: 1 addition & 1 deletion src/dx/subscribe/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ where
.gt(current_cursor)
.then(|| *cursor_slot = Some(catchup_cursor));
} else {
*cursor_slot = cursor.clone();
cursor_slot.clone_from(&cursor);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dx/subscribe/subscription_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ where
if !event_handlers.is_empty() {
if let Some((_, handler)) = event_handlers.iter().next() {
if let Some(handler) = handler.upgrade().clone() {
client = handler.client().upgrade().clone();
client.clone_from(&handler.client().upgrade());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/dx/subscribe/subscription_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ where
.gt(current_cursor)
.then(|| *cursor_slot = Some(catchup_cursor));
} else {
*cursor_slot = cursor.clone();
cursor_slot.clone_from(&cursor);
}
}
}
Expand Down Expand Up @@ -1174,7 +1174,7 @@ mod it_should {
.into_iter()
.map(|name| client.channel(name).subscription(None))
.collect::<Vec<Subscription<_, _>>>();
let channels_3_subscriptions = vec![
let channels_3_subscriptions = [
channels_1_subscriptions[0].clone(),
channels_2_subscriptions[1].clone(),
];
Expand Down

0 comments on commit 7fc6f71

Please sign in to comment.