Skip to content

Commit 85739d9

Browse files
authored
Fix clippy warnings (#2988)
I swapped the CI to nightly for clippy, as otherwise I couldn't ignore newly-added lints.
1 parent 4c840da commit 85739d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+188
-169
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ jobs:
1515
uses: actions/checkout@v4
1616

1717
- name: Install toolchain
18-
uses: dtolnay/rust-toolchain@stable
18+
uses: dtolnay/rust-toolchain@nightly
19+
with:
20+
components: clippy
1921

2022
- name: Add problem matchers
2123
run: echo "::add-matcher::.github/matchers/rust.json"
@@ -24,7 +26,7 @@ jobs:
2426
uses: Swatinem/rust-cache@v2
2527

2628
- name: Run clippy
27-
run: cargo clippy --workspace --tests -- -D warnings --cfg ignore_serenity_deprecated
29+
run: cargo clippy --workspace --tests --features full -- -D warnings --cfg ignore_serenity_deprecated
2830

2931
rustfmt:
3032
name: Format

command_attr/src/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn parse_values(attr: &Attribute) -> Result<Values> {
120120
#[derive(Debug, Clone)]
121121
struct DisplaySlice<'a, T>(&'a [T]);
122122

123-
impl<'a, T: fmt::Display> fmt::Display for DisplaySlice<'a, T> {
123+
impl<T: fmt::Display> fmt::Display for DisplaySlice<'_, T> {
124124
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
125125
let mut iter = self.0.iter().enumerate();
126126

command_attr/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,10 @@ pub fn command(attr: TokenStream, input: TokenStream) -> TokenStream {
234234
}
235235

236236
#[rustfmt::skip]
237-
/// A brother macro to [`command`], but for the help command. An interface for simple browsing of
238-
/// all the available commands the bot provides, and reading through specific information regarding
239-
/// a command.
237+
/// A brother macro to [`command`], but for the help command.
238+
///
239+
/// An interface for simple browsing of all the available commands the bot provides,
240+
/// and reading through specific information regarding a command.
240241
///
241242
/// As such, the options here will pertain in the help command's **layout** than its functionality.
242243
///
@@ -609,7 +610,6 @@ pub fn help(attr: TokenStream, input: TokenStream) -> TokenStream {
609610
/// the macro. For example: `#[group("Banana Phone")]`.
610611
///
611612
/// [`command`]: macro@command
612-
613613
#[proc_macro_attribute]
614614
pub fn group(attr: TokenStream, input: TokenStream) -> TokenStream {
615615
let group = parse_macro_input!(input as GroupStruct);

src/builder/create_attachment.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ enum NewOrExisting {
137137
///
138138
/// ```rust,no_run
139139
/// # use serenity::all::*;
140-
/// # async fn _foo(ctx: Http, mut msg: Message) -> Result<(), Error> {
140+
/// # async fn foo_(ctx: Http, mut msg: Message) -> Result<(), Error> {
141141
/// msg.edit(ctx, EditMessage::new().attachments(EditAttachments::new())).await?;
142142
/// # Ok(()) }
143143
/// ```
@@ -146,7 +146,7 @@ enum NewOrExisting {
146146
///
147147
/// ```rust,no_run
148148
/// # use serenity::all::*;
149-
/// # async fn _foo(ctx: Http, mut msg: Message, my_attachment: CreateAttachment) -> Result<(), Error> {
149+
/// # async fn foo_(ctx: Http, mut msg: Message, my_attachment: CreateAttachment) -> Result<(), Error> {
150150
/// msg.edit(ctx, EditMessage::new().attachments(
151151
/// EditAttachments::keep_all(&msg).add(my_attachment)
152152
/// )).await?;
@@ -157,7 +157,7 @@ enum NewOrExisting {
157157
///
158158
/// ```rust,no_run
159159
/// # use serenity::all::*;
160-
/// # async fn _foo(ctx: Http, mut msg: Message, my_attachment: CreateAttachment) -> Result<(), Error> {
160+
/// # async fn foo_(ctx: Http, mut msg: Message, my_attachment: CreateAttachment) -> Result<(), Error> {
161161
/// msg.edit(ctx, EditMessage::new().attachments(
162162
/// EditAttachments::new().keep(msg.attachments[0].id)
163163
/// )).await?;
@@ -168,7 +168,7 @@ enum NewOrExisting {
168168
///
169169
/// ```rust,no_run
170170
/// # use serenity::all::*;
171-
/// # async fn _foo(ctx: Http, mut msg: Message, my_attachment: CreateAttachment) -> Result<(), Error> {
171+
/// # async fn foo_(ctx: Http, mut msg: Message, my_attachment: CreateAttachment) -> Result<(), Error> {
172172
/// msg.edit(ctx, EditMessage::new().attachments(
173173
/// EditAttachments::keep_all(&msg).remove(msg.attachments[0].id)
174174
/// )).await?;

src/builder/create_channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'a> CreateChannel<'a> {
256256

257257
#[cfg(feature = "http")]
258258
#[async_trait::async_trait]
259-
impl<'a> Builder for CreateChannel<'a> {
259+
impl Builder for CreateChannel<'_> {
260260
type Context<'ctx> = GuildId;
261261
type Built = GuildChannel;
262262

src/builder/create_components.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ impl Serialize for CreateSelectMenuKind {
178178
default_values: Vec<CreateSelectMenuDefault>,
179179
}
180180

181+
#[allow(clippy::ref_option)]
181182
fn map<I: Into<Mention> + Copy>(
182183
values: &Option<Vec<I>>,
183184
) -> impl Iterator<Item = CreateSelectMenuDefault> + '_ {

src/builder/create_forum_post.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a> CreateForumPost<'a> {
9696

9797
#[cfg(feature = "http")]
9898
#[async_trait::async_trait]
99-
impl<'a> Builder for CreateForumPost<'a> {
99+
impl Builder for CreateForumPost<'_> {
100100
type Context<'ctx> = ChannelId;
101101
type Built = GuildChannel;
102102

src/builder/create_invite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'a> CreateInvite<'a> {
198198

199199
#[cfg(feature = "http")]
200200
#[async_trait::async_trait]
201-
impl<'a> Builder for CreateInvite<'a> {
201+
impl Builder for CreateInvite<'_> {
202202
type Context<'ctx> = ChannelId;
203203
type Built = RichInvite;
204204

src/builder/create_scheduled_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a> CreateScheduledEvent<'a> {
124124

125125
#[cfg(feature = "http")]
126126
#[async_trait::async_trait]
127-
impl<'a> Builder for CreateScheduledEvent<'a> {
127+
impl Builder for CreateScheduledEvent<'_> {
128128
type Context<'ctx> = GuildId;
129129
type Built = ScheduledEvent;
130130

src/builder/create_stage_instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'a> CreateStageInstance<'a> {
5656

5757
#[cfg(feature = "http")]
5858
#[async_trait::async_trait]
59-
impl<'a> Builder for CreateStageInstance<'a> {
59+
impl Builder for CreateStageInstance<'_> {
6060
type Context<'ctx> = ChannelId;
6161
type Built = StageInstance;
6262

0 commit comments

Comments
 (0)