Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
daa1e8d
Add Nix flake
ada4a Sep 13, 2025
f82b3c2
parser: bump edition to 2024
ada4a Sep 13, 2025
deb5439
unused/elidable lifetimes
ada4a Sep 14, 2025
5b2c130
redundant refs/derefs
ada4a Sep 14, 2025
8a7c9f7
clippy::uninlined_format_args
ada4a Sep 14, 2025
b094757
clippy::if_not_else
ada4a Sep 14, 2025
659d85e
clippy::needless_return
ada4a Sep 14, 2025
8df056e
explicit iterator loops
ada4a Sep 14, 2025
52d5270
clippy::useless_conversion
ada4a Sep 16, 2025
258e3b7
simplify thanks to the previous commit
ada4a Sep 16, 2025
60602d0
simplify `match`es
ada4a Sep 13, 2025
88731ed
use `std::iter::zip`
ada4a Sep 15, 2025
82259d8
clippy::inefficient_to_string
ada4a Sep 15, 2025
ef55ea7
clippy::ignored_unit_patterns
ada4a Sep 15, 2025
69cb114
derive `Default` for `IssueLinksCheckCommitsConfig`
ada4a Sep 15, 2025
8760f36
use more idiomatic iterator/`Option` adaptors
ada4a Sep 15, 2025
32ea017
clean-up consts
ada4a Sep 15, 2025
778ba02
use `let-else`
ada4a Sep 15, 2025
031aa5d
clippy::cast_lossless
ada4a Sep 15, 2025
554289e
documentation lints
ada4a Sep 15, 2025
d978fc5
reborrow instead of slicing
ada4a Sep 15, 2025
d15c931
add/remove semicolons
ada4a Sep 15, 2025
b331922
clippy::write_with_newline
ada4a Sep 15, 2025
38ba2dd
clippy::manual_string_new
ada4a Sep 15, 2025
c27e100
clippy::single_char_pattern
ada4a Sep 15, 2025
9989a85
clippy::implicit_clone
ada4a Sep 15, 2025
93a80e0
get `command` without unwrapping
ada4a Sep 15, 2025
1da5e71
`write!` _inside_ `match`
ada4a Sep 15, 2025
e2903b5
clippy::unneded_struct_pattern
ada4a Sep 15, 2025
01d4d27
clippy::manual_strip
ada4a Sep 15, 2025
867b95f
clippy::manual_assert
ada4a Sep 15, 2025
d92c33d
needless `into_iter`
ada4a Sep 14, 2025
7d729ff
clippy::legacy_numeric_constants
ada4a Sep 14, 2025
8372962
clippy::inconsistent_struct_constructor
ada4a Sep 14, 2025
efdd2a8
clippy::redundant_closure_for_method_calls
ada4a Sep 14, 2025
f846986
clippy::manual_is_variant_and
ada4a Sep 14, 2025
6ba8cc3
clippy::needless_raw_string_hashes
ada4a Sep 14, 2025
5ed9adf
clippy::question_mark
ada4a Sep 14, 2025
41bde06
construct `HashMap` from array
ada4a Sep 14, 2025
bc1d4ab
clippy::collapsible{,_else}_if
ada4a Sep 14, 2025
ea0801a
use `Result::ok_or` for trying out multiple things
ada4a Sep 14, 2025
05ecbd4
use `as_deref` to avoid allocating a String
ada4a Sep 15, 2025
2d19376
`RustcFormat::store_version`: take params by reference
ada4a Sep 14, 2025
4ea6b20
`config`: introduce `MaybeConfig` type alias
ada4a Sep 14, 2025
42e4037
avoid eager/useless `format!`s
ada4a Sep 14, 2025
8018914
replace `std::iter::once(_)` with `[_]`
ada4a Sep 14, 2025
93ad1fa
use `Itertools::format`
ada4a Sep 14, 2025
5930e34
replace `.ok_or_else(|| anyhow::anyhow!` with `.context(`
ada4a Sep 14, 2025
3a1133f
don't destructure tuple for comparison
ada4a Sep 14, 2025
929f3d4
`expect` some lints
ada4a Sep 16, 2025
cee3a6a
clippy::field_reassign_with_default
ada4a Sep 16, 2025
284ba8c
clippy::vec_init_then_push
ada4a Sep 16, 2025
ac4d7df
avoid `clippy::partialeq_to_none`
ada4a Sep 16, 2025
b722c5f
clippy::manual_find
ada4a Sep 16, 2025
4382423
clippy::ptr_arg
ada4a Sep 16, 2025
7443c6c
deref `Label` to `&str` directly
ada4a Sep 16, 2025
8031a82
clippy::redundant_pattern_matching
ada4a Sep 16, 2025
9b541d0
lints on FCP-related items
ada4a Sep 16, 2025
45d88f8
clippy::unused_self
ada4a Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/handlers/check_commits/issue_links.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::fmt::Write;
use std::sync::LazyLock;

use regex::Regex;
Expand Down Expand Up @@ -30,8 +31,10 @@ pub(super) fn issue_links_in_commits(
.any(|i| c.commit.message.starts_with(i))
})
.filter(|c| does_match(&c.commit.message))
.map(|c| format!("- {}\n", c.sha))
.collect::<String>();
.fold(String::new(), |mut commits, c| {
_ = writeln!(commits, "- {}", c.sha);
commits
});
Comment on lines -33 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure about clippy::format_collect, I'm not finding it particularly more readable compared to before, and it's not like this code is perf sensitive anyway.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right -- not to mention that clippy::format_collect is pedantic.

I could theoretically use Itertools::format_with instead:

.format_with("\n", |c, f| f(&format_args!("- {}", c.sha)))
.to_string();

But it's also not the most readable imo. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I also don't find it more readable IMO.


if issue_links_commits.is_empty() {
None
Expand Down
8 changes: 6 additions & 2 deletions src/handlers/check_commits/no_mentions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Purpose: When opening a PR, or pushing new changes, check for github mentions
//! in commits and notify the user of our no-mentions in commits policy.

use std::fmt::Write;

use crate::{config::NoMentionsConfig, github::GithubCommit};

pub(super) fn mentions_in_commits(
Expand All @@ -22,8 +24,10 @@ pub(super) fn mentions_in_commits(
let mentions = parser::get_mentions(&c.commit.message);
!mentions.is_empty() && mentions.iter().any(|m| *m != "rustbot")
})
.map(|c| format!("- {}\n", c.sha))
.collect::<String>();
.fold(String::new(), |mut commits, c| {
_ = writeln!(commits, "- {}", c.sha);
commits
});

if mentions_commits.is_empty() {
None
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/check_commits/no_merges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn get_default_message<'a>(
default_branch: &str,
commits: impl IntoIterator<Item = &'a str>,
) -> String {
let mut message = format!(
let mut message = String::from(
"The following commits have merge commits (commits with multiple parents) in your changes. \
We have a [no merge policy](https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy) \
so these commits will need to be removed for this pull request to be merged.
Expand Down
8 changes: 5 additions & 3 deletions src/handlers/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//!
//! Parsing is done in the `parser::command::ping` module.

use std::borrow::Cow;

use crate::{
config::PingConfig,
github::{self, Event},
Expand Down Expand Up @@ -89,10 +91,10 @@ pub(super) async fn handle_command(
}
}

let ping_msg = if users.is_empty() {
format!("no known users to ping?")
let ping_msg: Cow<_> = if users.is_empty() {
"no known users to ping?".into()
} else {
format!("cc {}", users.join(" "))
format!("cc {}", users.join(" ")).into()
};
let comment = format!("{}\n\n{}", config.message, ping_msg);
event
Expand Down
12 changes: 5 additions & 7 deletions src/handlers/types_planning_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,17 @@ impl Job for TypesPlanningMeetingThreadOpenJob {
if first_monday.month() == today.month() {
return Ok(());
}
let meeting_date_string = first_monday.format("%Y-%m-%d").to_string();
let message = format!(
"\
let meeting_date_string = first_monday.format("%Y-%m-%d");
let message = "\
Hello @*T-types/meetings*. Monthly planning meeting in one week.\n\
This is a reminder to update the current [roadmap tracking issues](https://github.com/rust-lang/types-team/issues?q=is%3Aissue+is%3Aopen+label%3Aroadmap-tracking-issue).\n\
Extra reminders will be sent later this week."
);
Extra reminders will be sent later this week.";
let zulip_req = crate::zulip::MessageApiRequest {
recipient: Recipient::Stream {
id: TYPES_MEETINGS_STREAM,
topic: &format!("{meeting_date_string} planning meeting"),
},
content: &message,
content: message,
};
zulip_req.send(&ctx.zulip).await?;

Expand All @@ -51,7 +49,7 @@ impl Job for TypesPlanningMeetingThreadOpenJob {
let noon = NaiveTime::from_hms_opt(12, 0, 0).unwrap();
let thursday_at_noon = Utc.from_utc_datetime(&thursday.and_time(noon));
let metadata = serde_json::value::to_value(PlanningMeetingUpdatesPingMetadata {
date_string: meeting_date_string,
date_string: meeting_date_string.to_string(),
})
.unwrap();
schedule_job(
Expand Down
13 changes: 8 additions & 5 deletions src/notification_listing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::fmt::Write;
use std::sync::Arc;

use anyhow::Context as _;
Expand Down Expand Up @@ -39,15 +40,16 @@ pub async fn notifications(
out.push_str("</head>");
out.push_str("<body>");

out.push_str(&format!("<h3>Pending notifications for {}</h3>", user));
_ = write!(out, "<h3>Pending notifications for {user}</h3>");

if notifications.is_empty() {
out.push_str("<p><em>You have no pending notifications! :)</em></p>");
} else {
out.push_str("<ol>");
for notification in notifications {
out.push_str("<li>");
out.push_str(&format!(
_ = write!(
out,
"<a href='{}'>{}</a>",
notification.origin_url,
notification
Expand All @@ -59,17 +61,18 @@ pub async fn notifications(
.replace('>', "&gt;")
.replace('"', "&quot;")
.replace('\'', "&#39;"),
));
);
if let Some(metadata) = &notification.metadata {
out.push_str(&format!(
_ = write!(
out,
"<ul><li>{}</li></ul>",
metadata
.replace('&', "&amp;")
.replace('<', "&lt;")
.replace('>', "&gt;")
.replace('"', "&quot;")
.replace('\'', "&#39;"),
));
);
}
out.push_str("</li>");
}
Expand Down
7 changes: 4 additions & 3 deletions src/zulip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,9 @@ async fn acknowledge(
} else {
let mut resp = String::from("Acknowledged:\n");
for deleted in deleted {
resp.push_str(&format!(
" * [{}]({}){}\n",
_ = writeln!(
resp,
" * [{}]({}){}",
deleted
.short_description
.as_deref()
Expand All @@ -824,7 +825,7 @@ async fn acknowledge(
deleted
.metadata
.map_or(String::new(), |m| format!(" ({m})")),
));
);
}
resp
};
Expand Down