Skip to content

Commit

Permalink
Fix lints after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
rnarubin committed Oct 15, 2021
1 parent 5e20c7e commit 1fdbae7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/backends/googlepubsub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ macro_rules! match_fields {
}) => {},
None => {}
};
()
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/backends/googlepubsub/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
///
/// See the GCP documentation on topics [here](https://cloud.google.com/pubsub/docs/admin)
pub async fn create_topic(&mut self, topic: TopicConfig<'_>) -> Result<(), PubSubError> {
let topic = topic.into_topic(&self);
let topic = topic.into_topic(self);
self.client.create_topic(topic).await?;

Ok(())
Expand Down
12 changes: 10 additions & 2 deletions src/backends/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ impl MockPublisher {
}
}

impl Default for MockPublisher {
fn default() -> Self {
Self::new()
}
}

impl<M> crate::Publisher<M> for MockPublisher
where
M: crate::EncodableMessage,
Expand All @@ -87,10 +93,12 @@ where
}
}

type Subscriptions = BTreeMap<MockSubscription, Channel<ValidatedMessage>>;

/// The sink used by the `MockPublisher`
#[derive(Debug, Clone)]
pub struct MockSink {
topics: Arc<Mutex<BTreeMap<Topic, BTreeMap<MockSubscription, Channel<ValidatedMessage>>>>>,
topics: Arc<Mutex<BTreeMap<Topic, Subscriptions>>>,
}

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

// find the subscriptions for this topic
let subscriptions = topics.entry(topic).or_insert(BTreeMap::new());
let subscriptions = topics.entry(topic).or_insert_with(Subscriptions::new);

// Send to every subscription that still has consumers. If a subscription's consumers are
// all dropped, the channel will have been closed and should be removed from the list
Expand Down
2 changes: 1 addition & 1 deletion src/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ impl From<&'static str> for Topic {

impl AsRef<str> for Topic {
fn as_ref(&self) -> &str {
&self.0
self.0
}
}

0 comments on commit 1fdbae7

Please sign in to comment.