Skip to content

Commit 8fd726d

Browse files
committed
Clippy fixes.
1 parent 2ca312f commit 8fd726d

File tree

9 files changed

+18
-16
lines changed

9 files changed

+18
-16
lines changed

api/swimos_form/tests/structure.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ fn test_enum_tag() {
530530

531531
#[derive(Form, Debug, PartialEq, Clone)]
532532

533-
struct LogEntry<F: Form> {
533+
struct LogEntry<F> {
534534
#[form(tag)]
535535
level: Level,
536536
#[form(header)]
@@ -559,6 +559,7 @@ fn test_enum_tag() {
559559
}
560560

561561
#[test]
562+
#[allow(clippy::multiple_bound_locations)]
562563
fn generic_duplicated_bound() {
563564
#[derive(Form)]
564565

api/swimos_model/src/text/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ fn extend_text_with_strings() {
661661

662662
#[test]
663663
fn extend_text_with_strings_by_ref() {
664-
let strs = vec![
664+
let strs = [
665665
"the ".to_string(),
666666
"cat ".to_string(),
667667
"sat ".to_string(),

api/swimos_schema/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,7 @@ fn form_enum_variants() {
15971597
},
15981598
]);
15991599

1600-
let enums = vec![
1600+
let enums = [
16011601
E::Unit,
16021602
E::NewType(i32::max_value()),
16031603
E::Tuple(i32::max_value(), i64::max_value(), String::from("swimos")),

client/runtime/src/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ async fn runtime_task<Net, Ws, Provider>(
446446
host,
447447
result: Ok((addr, attach)),
448448
} => {
449-
assert!(peers.get(&addr).is_none());
449+
assert!(!peers.contains_key(&addr));
450450
let peer = Peer::new(attach);
451451

452452
for (key, pending_downlink) in pending.drain_connection_queue(host.clone()) {

macro_utilities/src/label.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use core::fmt;
1616
use core::fmt::{Debug, Formatter};
1717
use proc_macro2::{Ident, TokenStream};
1818
use quote::ToTokens;
19+
use std::fmt::Display;
1920
use syn::Index;
2021

2122
/// An enumeration representing a field or a compound type. This enumeration helps to keep track of
@@ -35,7 +36,7 @@ pub enum Label {
3536

3637
impl Debug for Label {
3738
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
38-
write!(f, "{}", self.to_string())
39+
write!(f, "{}", self)
3940
}
4041
}
4142

@@ -92,13 +93,13 @@ impl Label {
9293
}
9394
}
9495

95-
impl ToString for Label {
96-
fn to_string(&self) -> String {
96+
impl Display for Label {
97+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
9798
match self {
98-
Label::Unmodified(ident) => ident.to_string(),
99-
Label::Renamed { new_label, .. } => new_label.to_string(),
100-
Label::Anonymous(index) => format!("__self_{}", index.index),
101-
Label::Foreign(ident, ..) => ident.to_string(),
99+
Label::Unmodified(ident) => write!(f, "{}", ident),
100+
Label::Renamed { new_label, .. } => write!(f, "{}", new_label),
101+
Label::Anonymous(index) => write!(f, "__self_{}", index.index),
102+
Label::Foreign(ident, ..) => write!(f, "{}", ident),
102103
}
103104
}
104105
}

server/swimos_agent/src/agent_lifecycle/utility/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl<Agent: 'static> HandlerContext<Agent> {
325325
/// #Arguments
326326
/// * `lane` - Projection to the value lane.
327327
/// * `value` - The value of the command.
328-
pub fn command<T: Send + 'static>(
328+
pub fn command<T>(
329329
&self,
330330
lane: fn(&Agent) -> &CommandLane<T>,
331331
value: T,

swimos_utilities/byte_channel/src/coop/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mod tests;
2828
const DEFAULT_START_BUDGET: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(64) };
2929

3030
thread_local! {
31-
static TASK_BUDGET: Cell<Option<usize>> = Cell::new(None);
31+
static TASK_BUDGET: Cell<Option<usize>> = const { Cell::new(None) };
3232
}
3333

3434
#[inline]

swimos_utilities/swimos_rtree/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ where
173173
/// assert_eq!(rtree.len(), 2);
174174
/// ```
175175
pub fn insert(&mut self, label: L, item: B) -> Result<(), DuplicateLabelError<L>> {
176-
if self.lookup_map.get(&label).is_some() {
176+
if self.lookup_map.contains_key(&label) {
177177
return Err(DuplicateLabelError(label));
178178
}
179179

@@ -322,7 +322,7 @@ where
322322
let mut entries = Vec::new();
323323

324324
for (label, item) in items.into_iter() {
325-
if lookup_map.get(&label).is_some() {
325+
if lookup_map.contains_key(&label) {
326326
return Err(RTreeError::from(DuplicateLabelError(label)));
327327
}
328328

swimos_utilities/swimos_trigger/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl Future for Receiver {
123123
0 => {
124124
if let Some(waker) = slot.and_then(|i| lock.get_mut(i)) {
125125
if !waker.will_wake(cx.waker()) {
126-
*waker = cx.waker().clone();
126+
waker.clone_from(cx.waker());
127127
}
128128
} else {
129129
*slot = Some(lock.insert(cx.waker().clone()));

0 commit comments

Comments
 (0)