Skip to content

Commit

Permalink
Remove remaining instances of private _nonexhausive fields (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamran Mackey committed Dec 4, 2020
1 parent ba85299 commit ac66a54
Show file tree
Hide file tree
Showing 29 changed files with 97 additions and 250 deletions.
6 changes: 0 additions & 6 deletions src/builder/create_embed.rs
Expand Up @@ -534,27 +534,23 @@ mod test {
inline: false,
name: "a".to_string(),
value: "b".to_string(),
_nonexhaustive: (),
},
EmbedField {
inline: true,
name: "c".to_string(),
value: "z".to_string(),
_nonexhaustive: (),
},
],
footer: Some(EmbedFooter {
icon_url: Some("https://i.imgur.com/XfWpfCV.gif".to_string()),
proxy_icon_url: None,
text: "This is a hakase footer".to_string(),
_nonexhaustive: (),
}),
image: Some(EmbedImage {
height: 213,
proxy_url: "a".to_string(),
url: "https://i.imgur.com/XfWpfCV.gif".to_string(),
width: 224,
_nonexhaustive: (),
}),
kind: "rich".to_string(),
provider: None,
Expand All @@ -566,9 +562,7 @@ mod test {
height: 213,
url: "https://i.imgur.com/XfWpfCV.mp4".to_string(),
width: 224,
_nonexhaustive: (),
}),
_nonexhaustive: (),
};

let mut builder = CreateEmbed::from(embed);
Expand Down
8 changes: 0 additions & 8 deletions src/cache/mod.rs
Expand Up @@ -1006,7 +1006,6 @@ mod test {
bot: false,
discriminator: 1,
name: "user 1".to_owned(),
_nonexhaustive: (),
},
channel_id: ChannelId(2),
guild_id: Some(GuildId(1)),
Expand All @@ -1030,9 +1029,7 @@ mod test {
message_reference: None,
flags: None,
referenced_message: None,
_nonexhaustive: (),
},
_nonexhaustive: (),
};
// Check that the channel cache doesn't exist.
assert!(!cache.messages.read().await.contains_key(&event.message.channel_id));
Expand Down Expand Up @@ -1076,14 +1073,12 @@ mod test {
user_limit: None,
nsfw: false,
slow_mode_rate: Some(0),
_nonexhaustive: (),
};

// Add a channel delete event to the cache, the cached messages for that
// channel should now be gone.
let mut delete = ChannelDeleteEvent {
channel: Channel::Guild(guild_channel.clone()),
_nonexhaustive: (),
};
assert!(cache.update(&mut delete).await.is_none());
assert!(!cache.messages.read().await.contains_key(&delete.channel.id()));
Expand Down Expand Up @@ -1126,9 +1121,7 @@ mod test {
banner: None,
vanity_url_code: Some("bruhmoment".to_string()),
preferred_locale: "en-US".to_string(),
_nonexhaustive: (),
},
_nonexhaustive: (),
}
};
assert!(cache.update(&mut guild_create).await.is_none());
Expand All @@ -1139,7 +1132,6 @@ mod test {
id: GuildId(1),
unavailable: false,
},
_nonexhaustive: (),
};

// The guild existed in the cache, so the cache's guild is returned by the
Expand Down
3 changes: 1 addition & 2 deletions src/framework/standard/help_commands.rs
Expand Up @@ -126,6 +126,7 @@ pub struct SuggestedCommandName {

/// A single command containing all related pieces of information.
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct Command<'a> {
pub name: &'static str,
pub group_name: &'static str,
Expand All @@ -137,7 +138,6 @@ pub struct Command<'a> {
pub usage: Option<&'static str>,
pub usage_sample: Vec<&'static str>,
pub checks: Vec<String>,
pub(crate) _nonexhaustive: (),
}

/// Contains possible suggestions in case a command could not be found
Expand Down Expand Up @@ -600,7 +600,6 @@ async fn _nested_group_command_search<'rec, 'a: 'rec>(
usage: options.usage,
usage_sample: options.examples.to_vec(),
sub_commands: sub_command_names,
_nonexhaustive: (),
},
});
}
Expand Down
9 changes: 3 additions & 6 deletions src/model/application.rs
Expand Up @@ -10,6 +10,7 @@ use std::fmt;
/// Information about a user's application. An application does not necessarily
/// have an associated bot user.
#[derive(Clone, Deserialize, Serialize)]
#[non_exhaustive]
pub struct ApplicationInfo {
/// The bot user associated with the application. See [`BotApplication`] for
/// more information.
Expand Down Expand Up @@ -49,8 +50,6 @@ pub struct ApplicationInfo {
///
/// This is not equivalent to the application's bot user's token.
pub secret: String,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

impl fmt::Debug for ApplicationInfo {
Expand All @@ -73,6 +72,7 @@ impl fmt::Debug for ApplicationInfo {

/// Information about an application with an application's bot user.
#[derive(Clone, Deserialize, Serialize)]
#[non_exhaustive]
pub struct BotApplication {
/// The unique Id of the bot user.
pub id: UserId,
Expand All @@ -95,8 +95,6 @@ pub struct BotApplication {
/// **Note**: Keep this information private, as untrusted sources can use it
/// to perform any action with a bot user.
pub token: String,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}


Expand All @@ -114,6 +112,7 @@ impl fmt::Debug for BotApplication {

/// Information about the current application and its owner.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct CurrentApplicationInfo {
pub description: String,
pub icon: Option<String>,
Expand All @@ -124,8 +123,6 @@ pub struct CurrentApplicationInfo {
pub bot_public: bool,
pub bot_require_code_grant: bool,
pub team: Option<Team>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

/// Information about the Team group of the application.
Expand Down
3 changes: 1 addition & 2 deletions src/model/channel/attachment.rs
Expand Up @@ -9,6 +9,7 @@ use crate::internal::prelude::*;
///
/// [`Embed`]: struct.Embed.html
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct Attachment {
/// The unique ID given to this attachment.
pub id: AttachmentId,
Expand All @@ -25,8 +26,6 @@ pub struct Attachment {
pub url: String,
/// If the attachment is an image, then the width of the image is provided.
pub width: Option<u64>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

#[cfg(feature = "model")]
Expand Down
4 changes: 1 addition & 3 deletions src/model/channel/channel_category.rs
Expand Up @@ -11,6 +11,7 @@ use crate::http::{Http, CacheHttp};
///
/// [`GuildChannel`]: struct.GuildChannel.html
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct ChannelCategory {
/// Id of this category.
pub id: ChannelId,
Expand All @@ -37,8 +38,6 @@ pub struct ChannelCategory {
///
/// [`GuildChannel`]: struct.GuildChannel.html
pub permission_overwrites: Vec<PermissionOverwrite>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

#[cfg(feature = "model")]
Expand Down Expand Up @@ -117,7 +116,6 @@ impl ChannelCategory {
name,
position,
kind,
_nonexhaustive: (),
};
})
}
Expand Down
25 changes: 8 additions & 17 deletions src/model/channel/embed.rs
Expand Up @@ -18,6 +18,7 @@ use crate::utils;
///
/// [slack's attachments]: https://api.slack.com/docs/message-attachments
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct Embed {
/// Information about the author of the embed.
pub author: Option<EmbedAuthor>,
Expand Down Expand Up @@ -67,8 +68,6 @@ pub struct Embed {
///
/// [`kind`]: #structfield.kind
pub video: Option<EmbedVideo>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

#[cfg(feature = "model")]
Expand Down Expand Up @@ -105,6 +104,7 @@ impl Embed {

/// An author object in an embed.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedAuthor {
/// The URL of the author icon.
///
Expand All @@ -116,12 +116,11 @@ pub struct EmbedAuthor {
pub proxy_icon_url: Option<String>,
/// The URL of the author.
pub url: Option<String>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

/// A field object in an embed.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedField {
/// Indicator of whether the field should display as inline.
pub inline: bool,
Expand All @@ -133,8 +132,6 @@ pub struct EmbedField {
///
/// The maxiumum length of this field is 1024 unicode codepoints.
pub value: String,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

impl EmbedField {
Expand All @@ -155,13 +152,13 @@ impl EmbedField {
name,
value,
inline,
_nonexhaustive: (),
}
}
}

/// Footer information for an embed.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedFooter {
/// The URL of the footer icon.
///
Expand All @@ -171,12 +168,11 @@ pub struct EmbedFooter {
pub proxy_icon_url: Option<String>,
/// The associated text with the footer.
pub text: String,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

/// An image object in an embed.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedImage {
/// The height of the image.
pub height: u64,
Expand All @@ -188,23 +184,21 @@ pub struct EmbedImage {
pub url: String,
/// The width of the image.
pub width: u64,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

/// The provider of an embed.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedProvider {
/// The name of the provider.
pub name: String,
/// The URL of the provider.
pub url: Option<String>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

/// The dimensions and URL of an embed thumbnail.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedThumbnail {
/// The height of the thumbnail in pixels.
pub height: u64,
Expand All @@ -216,19 +210,16 @@ pub struct EmbedThumbnail {
pub url: String,
/// The width of the thumbnail in pixels.
pub width: u64,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

/// Video information for an embed.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct EmbedVideo {
/// The height of the video in pixels.
pub height: u64,
/// The source URL of the video.
pub url: String,
/// The width of the video in pixels.
pub width: u64,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}
3 changes: 1 addition & 2 deletions src/model/channel/guild_channel.rs
Expand Up @@ -50,6 +50,7 @@ use std::sync::Arc;
/// News channels are a subset of text channels and lack slow mode hence
/// `slow_mode_rate` will be `None`.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[non_exhaustive]
pub struct GuildChannel {
/// The unique Id of the channel.
///
Expand Down Expand Up @@ -114,8 +115,6 @@ pub struct GuildChannel {
/// channels.
#[serde(default, rename = "rate_limit_per_user")]
pub slow_mode_rate: Option<u64>,
#[serde(skip)]
pub(crate) _nonexhaustive: (),
}

#[cfg(feature = "model")]
Expand Down

0 comments on commit ac66a54

Please sign in to comment.