Skip to content

Commit 1fdbae7

Browse files
committed
Fix lints after rebase
1 parent 5e20c7e commit 1fdbae7

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/backends/googlepubsub/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ macro_rules! match_fields {
7070
}) => {},
7171
None => {}
7272
};
73-
()
7473
};
7574
}
7675
}

src/backends/googlepubsub/publisher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ where
7979
///
8080
/// See the GCP documentation on topics [here](https://cloud.google.com/pubsub/docs/admin)
8181
pub async fn create_topic(&mut self, topic: TopicConfig<'_>) -> Result<(), PubSubError> {
82-
let topic = topic.into_topic(&self);
82+
let topic = topic.into_topic(self);
8383
self.client.create_topic(topic).await?;
8484

8585
Ok(())

src/backends/mock.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ impl MockPublisher {
7575
}
7676
}
7777

78+
impl Default for MockPublisher {
79+
fn default() -> Self {
80+
Self::new()
81+
}
82+
}
83+
7884
impl<M> crate::Publisher<M> for MockPublisher
7985
where
8086
M: crate::EncodableMessage,
@@ -87,10 +93,12 @@ where
8793
}
8894
}
8995

96+
type Subscriptions = BTreeMap<MockSubscription, Channel<ValidatedMessage>>;
97+
9098
/// The sink used by the `MockPublisher`
9199
#[derive(Debug, Clone)]
92100
pub struct MockSink {
93-
topics: Arc<Mutex<BTreeMap<Topic, BTreeMap<MockSubscription, Channel<ValidatedMessage>>>>>,
101+
topics: Arc<Mutex<BTreeMap<Topic, Subscriptions>>>,
94102
}
95103

96104
#[derive(Debug, Clone)]
@@ -115,7 +123,7 @@ impl sink::Sink<(Topic, ValidatedMessage)> for MockSink {
115123
// send the message to every subscription listening on the given topic
116124

117125
// find the subscriptions for this topic
118-
let subscriptions = topics.entry(topic).or_insert(BTreeMap::new());
126+
let subscriptions = topics.entry(topic).or_insert_with(Subscriptions::new);
119127

120128
// Send to every subscription that still has consumers. If a subscription's consumers are
121129
// all dropped, the channel will have been closed and should be removed from the list

src/topic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ impl From<&'static str> for Topic {
1616

1717
impl AsRef<str> for Topic {
1818
fn as_ref(&self) -> &str {
19-
&self.0
19+
self.0
2020
}
2121
}

0 commit comments

Comments
 (0)