Skip to content

Commit

Permalink
Change methods on Http to take &JsonMap instead of JsonMap (#1637)
Browse files Browse the repository at this point in the history
The `Http::send_files` and `Http::execute_webhook_with_files` methods
were the only ones that took ownership of their `map` argument, which
seemed unnecessary.
  • Loading branch information
mkrasnitski authored and arqunis committed Mar 15, 2022
1 parent 48de0e5 commit b1389aa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/http/client.rs
Expand Up @@ -2197,7 +2197,7 @@ impl Http {
token: &str,
wait: bool,
files: It,
map: JsonMap,
map: &JsonMap,
) -> Result<Option<Message>>
where
T: Into<AttachmentType<'a>>,
Expand Down Expand Up @@ -3484,7 +3484,7 @@ impl Http {
&self,
channel_id: u64,
files: It,
map: JsonMap,
map: &JsonMap,
) -> Result<Message>
where
T: Into<AttachmentType<'a>>,
Expand Down
4 changes: 2 additions & 2 deletions src/model/channel/channel_id.rs
Expand Up @@ -730,7 +730,7 @@ impl ChannelId {

Message::check_lengths(&map)?;

http.as_ref().send_files(self.0, files, map).await
http.as_ref().send_files(self.0, files, &map).await
}

/// Sends a message to the channel.
Expand Down Expand Up @@ -767,7 +767,7 @@ impl ChannelId {
let message = if msg.2.is_empty() {
http.as_ref().send_message(self.0, &Value::from(map)).await?
} else {
http.as_ref().send_files(self.0, msg.2.clone(), map).await?
http.as_ref().send_files(self.0, msg.2.clone(), &map).await?
};

if let Some(reactions) = msg.1.clone() {
Expand Down
2 changes: 1 addition & 1 deletion src/model/webhook.rs
Expand Up @@ -314,7 +314,7 @@ impl Webhook {

if !execute_webhook.1.is_empty() {
http.as_ref()
.execute_webhook_with_files(self.id.0, token, wait, execute_webhook.1.clone(), map)
.execute_webhook_with_files(self.id.0, token, wait, execute_webhook.1.clone(), &map)
.await
} else {
http.as_ref().execute_webhook(self.id.0, token, wait, &map).await
Expand Down

0 comments on commit b1389aa

Please sign in to comment.