Skip to content

Commit 7fc6f71

Browse files
committed
test(lint): fix code style based on linter report
1 parent 53c7c67 commit 7fc6f71

File tree

9 files changed

+9
-38
lines changed

9 files changed

+9
-38
lines changed

examples/presence_state.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ struct State {
77
is_doing: String,
88
flag: bool,
99
}
10-
#[derive(Debug, serde::Serialize)]
11-
struct State2 {
12-
is_doing: String,
13-
business: String,
14-
}
1510

1611
#[tokio::main]
1712
async fn main() -> Result<(), Box<dyn snafu::Error>> {

src/core/event_engine/effect_dispatcher.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ where
159159
mod should {
160160
use super::*;
161161
use crate::core::event_engine::Event;
162-
use std::future::Future;
163162

164163
struct TestEvent;
165164

@@ -261,27 +260,6 @@ mod should {
261260
}
262261
}
263262

264-
#[derive(Clone)]
265-
struct TestRuntime {}
266-
267-
#[async_trait::async_trait]
268-
impl Runtime for TestRuntime {
269-
fn spawn<R>(&self, _future: impl Future<Output = R> + Send + 'static)
270-
where
271-
R: Send + 'static,
272-
{
273-
// Do nothing.
274-
}
275-
276-
async fn sleep(self, _delay: u64) {
277-
// Do nothing.
278-
}
279-
280-
async fn sleep_microseconds(self, _delay: u64) {
281-
// Do nothing.
282-
}
283-
}
284-
285263
#[test]
286264
fn create_not_managed_effect() {
287265
let (_tx, rx) = async_channel::bounded::<TestInvocation>(5);

src/core/retry_policy.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ impl RequestRetryConfiguration {
304304
/// * `Some(delay_in_microseconds)` - The delay in microseconds.
305305
/// * `None` - If `delay_in_seconds` is `None`.
306306
fn delay_in_microseconds(delay_in_seconds: Option<u64>) -> Option<u64> {
307-
let Some(delay_in_seconds) = delay_in_seconds else {
308-
return None;
309-
};
307+
let delay_in_seconds = delay_in_seconds?;
310308

311309
const MICROS_IN_SECOND: u64 = 1_000_000;
312310
let delay = delay_in_seconds * MICROS_IN_SECOND;

src/dx/access/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ mod it_should {
350350
response: None,
351351
request_handler: Some(Box::new(|req| {
352352
assert!(req.query_parameters.contains_key("timestamp"));
353-
assert!(req.query_parameters.get("timestamp").is_some());
353+
assert!(req.query_parameters.contains_key("timestamp"));
354354
})),
355355
};
356356

@@ -368,7 +368,7 @@ mod it_should {
368368
response: None,
369369
request_handler: Some(Box::new(|req| {
370370
assert!(req.query_parameters.contains_key("signature"));
371-
assert!(req.query_parameters.get("signature").is_some());
371+
assert!(req.query_parameters.contains_key("signature"));
372372
assert!(req
373373
.query_parameters
374374
.get("signature")

src/dx/presence/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ mod it_should {
840840
response: None,
841841
request_handler: Some(Box::new(|req| {
842842
assert!(req.query_parameters.contains_key("state"));
843-
assert!(req.query_parameters.get("state").is_some());
843+
assert!(req.query_parameters.contains_key("state"));
844844

845845
let state = req.query_parameters.get("state").unwrap();
846846
assert!(state.contains("channel_a"));

src/dx/subscribe/event_engine/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl SubscribeState {
329329
// Merge stored cursor with service-provided.
330330
let mut next_cursor = next_cursor.clone();
331331
if let Some(cursor) = cursor {
332-
next_cursor.timetoken = cursor.timetoken.clone();
332+
next_cursor.timetoken.clone_from(&cursor.timetoken);
333333
}
334334

335335
Some(self.transition_to(

src/dx/subscribe/subscription.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ where
537537
.gt(current_cursor)
538538
.then(|| *cursor_slot = Some(catchup_cursor));
539539
} else {
540-
*cursor_slot = cursor.clone();
540+
cursor_slot.clone_from(&cursor);
541541
}
542542
}
543543
}

src/dx/subscribe/subscription_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ where
346346
if !event_handlers.is_empty() {
347347
if let Some((_, handler)) = event_handlers.iter().next() {
348348
if let Some(handler) = handler.upgrade().clone() {
349-
client = handler.client().upgrade().clone();
349+
client.clone_from(&handler.client().upgrade());
350350
}
351351
}
352352
}

src/dx/subscribe/subscription_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ where
903903
.gt(current_cursor)
904904
.then(|| *cursor_slot = Some(catchup_cursor));
905905
} else {
906-
*cursor_slot = cursor.clone();
906+
cursor_slot.clone_from(&cursor);
907907
}
908908
}
909909
}
@@ -1174,7 +1174,7 @@ mod it_should {
11741174
.into_iter()
11751175
.map(|name| client.channel(name).subscription(None))
11761176
.collect::<Vec<Subscription<_, _>>>();
1177-
let channels_3_subscriptions = vec![
1177+
let channels_3_subscriptions = [
11781178
channels_1_subscriptions[0].clone(),
11791179
channels_2_subscriptions[1].clone(),
11801180
];

0 commit comments

Comments
 (0)