Skip to content

Commit 27d9a2f

Browse files
committed
chore: Update crate to Edition 2024
1 parent 3f332a5 commit 27d9a2f

30 files changed

+109
-114
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install stable toolchain
3232
uses: actions-rust-lang/setup-rust-toolchain@v1
3333
with:
34-
toolchain: 1.82.0
34+
toolchain: 1.85.0
3535
components: clippy, rustfmt
3636

3737
- name: Install sqlx-cli

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "bors"
33
version = "0.1.0"
4-
edition = "2021"
5-
rust-version = "1.80.0"
4+
edition = "2024"
5+
rust-version = "1.85.0"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.82 AS base
1+
FROM rust:1.85 AS base
22

33
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
44

src/bin/bors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use std::time::Duration;
66

77
use anyhow::Context;
88
use bors::{
9-
create_app, create_bors_process, create_github_client, load_repositories, BorsContext,
10-
BorsGlobalEvent, CommandParser, PgDbClient, ServerState, TeamApiClient, WebhookSecret,
9+
BorsContext, BorsGlobalEvent, CommandParser, PgDbClient, ServerState, TeamApiClient,
10+
WebhookSecret, create_app, create_bors_process, create_github_client, load_repositories,
1111
};
1212
use clap::Parser;
1313
use sqlx::postgres::PgConnectOptions;

src/bors/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
sync::{Arc, RwLock},
44
};
55

6-
use crate::{bors::command::CommandParser, github::GithubRepoName, PgDbClient};
6+
use crate::{PgDbClient, bors::command::CommandParser, github::GithubRepoName};
77

88
use super::RepositoryState;
99

src/bors/handlers/help.rs

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::bors::command::{Approver, BorsCommand, RollupMode};
21
use crate::bors::Comment;
32
use crate::bors::RepositoryState;
3+
use crate::bors::command::{Approver, BorsCommand, RollupMode};
44
use crate::github::PullRequest;
55
use std::sync::Arc;
66

@@ -49,45 +49,35 @@ pub(super) async fn command_help(
4949
fn get_command_help(command: BorsCommand) -> String {
5050
// !!! When modifying this match, also update the command list above (in [`command_help`]) !!!
5151
let help = match command {
52-
BorsCommand::Approve { approver: Approver::Myself, .. } => {
52+
BorsCommand::Approve {
53+
approver: Approver::Myself,
54+
..
55+
} => {
5356
"`r+ [p=<priority>] [rollup=<never/iffy/maybe/always>]`: Approve this PR. Optionally, you can specify `<priority>`, `<rollup>`."
5457
}
55-
BorsCommand::Approve {approver: Approver::Specified(_), ..} => {
58+
BorsCommand::Approve {
59+
approver: Approver::Specified(_),
60+
..
61+
} => {
5662
"`r=<user> [p=<priority>]`: Approve this PR on behalf of `<user>`. Optionally, you can specify a `<priority>`."
5763
}
58-
BorsCommand::Unapprove => {
59-
"`r-`: Unapprove this PR"
60-
}
61-
BorsCommand::SetPriority(_) => {
62-
"`p=<priority>`: Set the priority of this PR"
63-
}
64-
BorsCommand::Delegate => {
65-
"`delegate+`: Delegate approval authority to the PR author"
66-
}
67-
BorsCommand::Undelegate => {
68-
"`delegate-`: Remove any previously granted delegation"
69-
}
70-
BorsCommand::Help => {
71-
"`help`: Print this help message"
72-
}
73-
BorsCommand::Ping => {
74-
"`ping`: Check if the bot is alive"
75-
}
64+
BorsCommand::Unapprove => "`r-`: Unapprove this PR",
65+
BorsCommand::SetPriority(_) => "`p=<priority>`: Set the priority of this PR",
66+
BorsCommand::Delegate => "`delegate+`: Delegate approval authority to the PR author",
67+
BorsCommand::Undelegate => "`delegate-`: Remove any previously granted delegation",
68+
BorsCommand::Help => "`help`: Print this help message",
69+
BorsCommand::Ping => "`ping`: Check if the bot is alive",
7670
BorsCommand::Try { .. } => {
7771
"`try [parent=<parent>] [jobs=<jobs>]`: Start a try build. Optionally, you can specify a `<parent>` SHA or a list of `<jobs>` to run"
7872
}
79-
BorsCommand::TryCancel => {
80-
"`try cancel`: Cancel a running try build"
81-
}
73+
BorsCommand::TryCancel => "`try cancel`: Cancel a running try build",
8274
BorsCommand::SetRollupMode(_) => {
8375
"`rollup=<never/iffy/maybe/always>`: Mark the rollup status of the PR"
8476
}
8577
BorsCommand::Info => {
86-
"`info`: Get information about the current PR including delegation, priority, merge status, and try build status"
87-
}
88-
BorsCommand::OpenTree => {
89-
"`treeclosed-`: Open the repository tree for merging"
78+
"`info`: Get information about the current PR including delegation, priority, merge status, and try build status"
9079
}
80+
BorsCommand::OpenTree => "`treeclosed-`: Open the repository tree for merging",
9181
BorsCommand::TreeClosed(_) => {
9282
"`treeclosed=<priority>`: Close the tree for PRs with priority less than `<priority>`"
9383
}

src/bors/handlers/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ use crate::bors::handlers::refresh::refresh_repository;
99
use crate::bors::handlers::review::{
1010
command_approve, command_close_tree, command_open_tree, command_unapprove,
1111
};
12-
use crate::bors::handlers::trybuild::{command_try_build, command_try_cancel, TRY_BRANCH_NAME};
12+
use crate::bors::handlers::trybuild::{TRY_BRANCH_NAME, command_try_build, command_try_cancel};
1313
use crate::bors::handlers::workflow::{
1414
handle_check_suite_completed, handle_workflow_completed, handle_workflow_started,
1515
};
1616
use crate::bors::{BorsContext, Comment, RepositoryState};
1717
use crate::github::{GithubUser, PullRequest};
1818
use crate::permissions::PermissionType;
19-
use crate::{load_repositories, PgDbClient, TeamApiClient};
19+
use crate::{PgDbClient, TeamApiClient, load_repositories};
2020
use anyhow::Context;
2121
use octocrab::Octocrab;
2222
use pr_events::{
@@ -458,7 +458,7 @@ async fn has_permission(
458458

459459
#[cfg(test)]
460460
mod tests {
461-
use crate::tests::mocks::{run_test, Comment, User};
461+
use crate::tests::mocks::{Comment, User, run_test};
462462

463463
#[sqlx::test]
464464
async fn ignore_bot_comment(pool: sqlx::PgPool) {

src/bors/handlers/pr_events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
use crate::PgDbClient;
12
use crate::bors::event::{PullRequestEdited, PullRequestOpened, PullRequestPushed, PushToBranch};
23
use crate::bors::handlers::labels::handle_label_trigger;
34
use crate::bors::{Comment, RepositoryState};
45
use crate::database::MergeableState;
56
use crate::github::{CommitSha, LabelTrigger, PullRequestNumber};
6-
use crate::PgDbClient;
77
use std::sync::Arc;
88

99
pub(super) async fn handle_pull_request_edited(
@@ -130,7 +130,7 @@ mod tests {
130130
use crate::tests::mocks::default_pr_number;
131131
use crate::{
132132
database::MergeableState,
133-
tests::mocks::{default_branch_name, default_repo_name, run_test, User},
133+
tests::mocks::{User, default_branch_name, default_repo_name, run_test},
134134
};
135135

136136
#[sqlx::test]

src/bors/handlers/refresh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::time::Duration;
44
use anyhow::Context;
55
use chrono::{DateTime, Utc};
66

7-
use crate::bors::handlers::trybuild::cancel_build_workflows;
87
use crate::bors::Comment;
98
use crate::bors::RepositoryState;
9+
use crate::bors::handlers::trybuild::cancel_build_workflows;
1010
use crate::database::BuildStatus;
1111
use crate::{PgDbClient, TeamApiClient};
1212

@@ -107,10 +107,10 @@ fn elapsed_time(date: DateTime<Utc>) -> Duration {
107107

108108
#[cfg(test)]
109109
mod tests {
110-
use crate::bors::handlers::refresh::MOCK_TIME;
111110
use crate::bors::handlers::WAIT_FOR_WORKFLOW_STARTED;
111+
use crate::bors::handlers::refresh::MOCK_TIME;
112112
use crate::tests::mocks::{
113-
default_repo_name, run_test, BorsBuilder, GitHubState, WorkflowEvent,
113+
BorsBuilder, GitHubState, WorkflowEvent, default_repo_name, run_test,
114114
};
115115
use chrono::Utc;
116116
use std::future::Future;

src/bors/handlers/review.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
use std::sync::Arc;
22

3+
use crate::PgDbClient;
4+
use crate::bors::Comment;
5+
use crate::bors::RepositoryState;
36
use crate::bors::command::Approver;
47
use crate::bors::command::RollupMode;
58
use crate::bors::handlers::deny_request;
69
use crate::bors::handlers::has_permission;
710
use crate::bors::handlers::labels::handle_label_trigger;
8-
use crate::bors::Comment;
9-
use crate::bors::RepositoryState;
1011
use crate::database::ApprovalInfo;
1112
use crate::database::TreeState;
1213
use crate::github::GithubUser;
1314
use crate::github::LabelTrigger;
1415
use crate::github::PullRequest;
1516
use crate::permissions::PermissionType;
16-
use crate::PgDbClient;
1717

1818
/// Approve a pull request.
1919
/// A pull request can only be approved by a user of sufficient authority.
@@ -300,12 +300,12 @@ mod tests {
300300
use crate::database::TreeState;
301301
use crate::{
302302
bors::{
303-
handlers::{trybuild::TRY_MERGE_BRANCH_NAME, TRY_BRANCH_NAME},
304303
RollupMode,
304+
handlers::{TRY_BRANCH_NAME, trybuild::TRY_MERGE_BRANCH_NAME},
305305
},
306306
tests::mocks::{
307-
default_pr_number, default_repo_name, run_test, BorsBuilder, Comment, GitHubState,
308-
Permissions, User,
307+
BorsBuilder, Comment, GitHubState, Permissions, User, default_pr_number,
308+
default_repo_name, run_test,
309309
},
310310
};
311311

0 commit comments

Comments
 (0)