Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Migrate to Edition 2024 #866

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ resolver = "2"
[workspace.package]
repository = "https://github.com/crate-ci/cargo-release"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.82" # MSRV
edition = "2024"
rust-version = "1.85" # MSRV
include = [
"build.rs",
"src/**/*",
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ pub enum Command {
impl Command {
pub fn args(&self) -> Vec<&str> {
match self {
Command::Line(ref s) => vec![s.as_str()],
Command::Args(ref a) => a.iter().map(|s| s.as_str()).collect(),
Command::Line(s) => vec![s.as_str()],
Command::Args(a) => a.iter().map(|s| s.as_str()).collect(),
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/ops/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ fn upgrade_req(
log::debug!("unsupported dependency {}", name);
return false;
};
let existing_req = if let Ok(existing_req) = semver::VersionReq::parse(existing_req_str) {
existing_req
} else {
let Ok(existing_req) = semver::VersionReq::parse(existing_req_str) else {
log::debug!("unsupported dependency req {}={}", name, existing_req_str);
return false;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ impl HookStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ impl OwnerStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ impl PublishStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ impl PushStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
8 changes: 2 additions & 6 deletions src/steps/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ impl ReleaseStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in &excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down Expand Up @@ -154,9 +152,7 @@ impl ReleaseStep {
let pkgs = plan::plan(pkgs)?;

for excluded_pkg in &excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ impl ReplaceStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ impl TagStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
4 changes: 1 addition & 3 deletions src/steps/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ impl VersionStep {

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
for excluded_pkg in excluded_pkgs {
let pkg = if let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) {
pkg
} else {
let Some(pkg) = pkgs.get_mut(&excluded_pkg.id) else {
// Either not in workspace or marked as `release = false`.
continue;
};
Expand Down
Loading