Skip to content

Commit 4382423

Browse files
committed
clippy::ptr_arg
1 parent b722c5f commit 4382423

File tree

7 files changed

+19
-26
lines changed

7 files changed

+19
-26
lines changed

src/db.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,7 @@ pub async fn run_scheduled_jobs(ctx: &Context) -> anyhow::Result<()> {
257257
}
258258

259259
// Try to handle a specific job
260-
async fn handle_job(
261-
ctx: &Context,
262-
name: &String,
263-
metadata: &serde_json::Value,
264-
) -> anyhow::Result<()> {
260+
async fn handle_job(ctx: &Context, name: &str, metadata: &serde_json::Value) -> anyhow::Result<()> {
265261
for job in jobs() {
266262
if job.name() == name {
267263
return job.run(ctx, metadata).await;

src/db/jobs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub async fn delete_job(db: &DbClient, id: &Uuid) -> Result<()> {
5151
Ok(())
5252
}
5353

54-
pub async fn update_job_error_message(db: &DbClient, id: &Uuid, message: &String) -> Result<()> {
54+
pub async fn update_job_error_message(db: &DbClient, id: &Uuid, message: &str) -> Result<()> {
5555
tracing::trace!("update_job_error_message(id={id})");
5656

5757
db.execute(

src/gha_logs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct CachedLog {
3131
}
3232

3333
impl GitHubActionLogsCache {
34-
pub fn get(&mut self, key: &String) -> Option<Arc<CachedLog>> {
34+
pub fn get(&mut self, key: &str) -> Option<Arc<CachedLog>> {
3535
if let Some(pos) = self.entries.iter().position(|(k, _)| k == key) {
3636
// Move previously cached entry to the front
3737
let entry = self.entries.remove(pos).unwrap();

src/github.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,8 +1472,8 @@ impl Repository {
14721472
fn build_issues_url(
14731473
&self,
14741474
client: &GithubClient,
1475-
filters: &Vec<(&str, &str)>,
1476-
include_labels: &Vec<&str>,
1475+
filters: &[(&str, &str)],
1476+
include_labels: &[&str],
14771477
ordering: Ordering<'_>,
14781478
) -> String {
14791479
self.build_endpoint_url(client, "issues", filters, include_labels, ordering)
@@ -1482,8 +1482,8 @@ impl Repository {
14821482
fn build_pulls_url(
14831483
&self,
14841484
client: &GithubClient,
1485-
filters: &Vec<(&str, &str)>,
1486-
include_labels: &Vec<&str>,
1485+
filters: &[(&str, &str)],
1486+
include_labels: &[&str],
14871487
ordering: Ordering<'_>,
14881488
) -> String {
14891489
self.build_endpoint_url(client, "pulls", filters, include_labels, ordering)
@@ -1493,8 +1493,8 @@ impl Repository {
14931493
&self,
14941494
client: &GithubClient,
14951495
endpoint: &str,
1496-
filters: &Vec<(&str, &str)>,
1497-
include_labels: &Vec<&str>,
1496+
filters: &[(&str, &str)],
1497+
include_labels: &[&str],
14981498
ordering: Ordering<'_>,
14991499
) -> String {
15001500
let filters = filters
@@ -1515,9 +1515,9 @@ impl Repository {
15151515
fn build_search_issues_url(
15161516
&self,
15171517
client: &GithubClient,
1518-
filters: &Vec<(&str, &str)>,
1519-
include_labels: &Vec<&str>,
1520-
exclude_labels: &Vec<&str>,
1518+
filters: &[(&str, &str)],
1519+
include_labels: &[&str],
1520+
exclude_labels: &[&str],
15211521
ordering: Ordering<'_>,
15221522
) -> String {
15231523
let filters = filters

src/handlers/assign/tests/tests_from_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use super::super::*;
44
use std::fmt::Write;
55

6-
fn test_from_diff(diff: &Vec<FileDiff>, config: toml::Table, expected: &[&str]) {
6+
fn test_from_diff(diff: &[FileDiff], config: toml::Table, expected: &[&str]) {
77
let aconfig: AssignConfig = config.try_into().unwrap();
88
assert_eq!(
99
find_reviewers_from_diff(&aconfig, &*diff).unwrap(),

src/handlers/check_commits.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,7 @@ fn warning_from_warnings(warnings: &[String]) -> String {
290290
}
291291

292292
// Calculate the label changes
293-
fn calculate_label_changes(
294-
previous: &Vec<String>,
295-
current: &Vec<String>,
296-
) -> (Vec<String>, Vec<String>) {
293+
fn calculate_label_changes(previous: &[String], current: &[String]) -> (Vec<String>, Vec<String>) {
297294
let previous_set: HashSet<String> = previous.iter().cloned().collect();
298295
let current_set: HashSet<String> = current.iter().cloned().collect();
299296

@@ -305,8 +302,8 @@ fn calculate_label_changes(
305302

306303
// Calculate the error changes
307304
fn calculate_error_changes(
308-
previous: &Vec<(String, String)>,
309-
current: &Vec<String>,
305+
previous: &[(String, String)],
306+
current: &[String],
310307
) -> (Vec<(String, String)>, Vec<String>) {
311308
let previous_set: HashSet<(String, String)> = previous.iter().cloned().collect();
312309
let current_set: HashSet<String> = current.iter().cloned().collect();

src/handlers/check_commits/no_merges.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(super) fn merges_in_commits(
1212
issue_title: &str,
1313
repository: &Repository,
1414
config: &NoMergesConfig,
15-
commits: &Vec<GithubCommit>,
15+
commits: &[GithubCommit],
1616
) -> Option<(String, Vec<String>)> {
1717
// Don't trigger if the PR has any of the excluded title segments.
1818
if config
@@ -143,7 +143,7 @@ $ git push --force-with-lease
143143
let commit = dummy_commit_from_body("67c917fe5937e984f58f5003ccbb5c37e", "+ main.rs");
144144

145145
assert_eq!(
146-
merges_in_commits(&title, &repository, &config, &vec![commit]),
146+
merges_in_commits(&title, &repository, &config, &[commit]),
147147
None
148148
);
149149
}
@@ -155,7 +155,7 @@ $ git push --force-with-lease
155155
"Subtree update of rustc_custom_codegen",
156156
&repository,
157157
&config,
158-
&vec![commit_with_merge()]
158+
&[commit_with_merge()]
159159
),
160160
None
161161
);

0 commit comments

Comments
 (0)