From 2495c8f27e3c945db19eb0f4edf9f5ee7d42ca55 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 17 Mar 2023 15:42:55 -0700 Subject: [PATCH] cargo: update MSRV to 1.64 We need 1.64 to bump `clap` to `4.1`. We don't really need to upgrade to that, but being on an older version causes minor confusions like #1393. Rust 1.64 is very close to 6 months old at this point. --- .github/workflows/build.yml | 2 +- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- docs/contributing.md | 2 +- flake.nix | 2 +- lib/Cargo.toml | 2 +- lib/src/revset.rs | 2 +- src/cli_util.rs | 2 +- src/commands/git.rs | 2 +- src/diff_util.rs | 2 +- src/ui.rs | 18 ++++-------------- 11 files changed, 15 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d19f2fbe..961601a8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: rust_version: stable - build: linux-msrv os: ubuntu-latest - rust_version: "1.61" + rust_version: "1.64" - build: macos os: macos-latest rust_version: stable diff --git a/CHANGELOG.md b/CHANGELOG.md index 67b590859..f5b1a2cef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 current commit has no content and no description, such as right after a `jj squash`. +* The minimum supported Rust version (MSRV) is now 1.64.0. + ### New features * `jj git push --deleted` will remove all locally deleted branches from the remote. diff --git a/Cargo.toml b/Cargo.toml index f03f5932e..ca7a344c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "jujutsu" version = "0.7.0" authors = ["Martin von Zweigbergk "] edition = "2021" -rust-version = "1.61" # Remember to update CI, contributing.md, and flake.nix +rust-version = "1.64" # Remember to update CI, contributing.md, and flake.nix license = "Apache-2.0" description = "Jujutsu (an experimental VCS)" homepage = "https://github.com/martinvonz/jj" diff --git a/docs/contributing.md b/docs/contributing.md index 7e53cf8f7..54c88f93e 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -117,7 +117,7 @@ These are listed roughly in order of decreasing importance. 3. Your code will be rejected if it cannot be compiled with the minimal supported version of Rust. This version is listed as - `rust-version` in [`Cargo.toml`](../Cargo.toml); it is 1.61 as of this + `rust-version` in [`Cargo.toml`](../Cargo.toml); it is 1.64 as of this writing. 4. Your code needs to pass `cargo clippy`. You can also diff --git a/flake.nix b/flake.nix index db72dc174..8464bb5eb 100644 --- a/flake.nix +++ b/flake.nix @@ -92,7 +92,7 @@ buildInputs = with pkgs; [ # Using the minimal profile with explicit "clippy" extension to avoid # two versions of rustfmt - (rust-bin.stable."1.61.0".minimal.override { + (rust-bin.stable."1.64.0".minimal.override { extensions = [ "rust-src" # for rust-analyzer "clippy" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 4dbdf5c80..f41645ef7 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -3,7 +3,7 @@ name = "jujutsu-lib" version = "0.7.0" authors = ["Martin von Zweigbergk "] edition = "2021" -rust-version = "1.61" +rust-version = "1.64" license = "Apache-2.0" description = "Library for Jujutsu (an experimental VCS)" homepage = "https://github.com/martinvonz/jj" diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 33bc420dc..140915856 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1205,7 +1205,7 @@ fn internalize_filter(expression: &Rc) -> Option Option<(&Rc, &Rc)> { if let RevsetExpression::Intersection(expression1, expression2) = expression { - is_filter(expression2).then(|| (expression1, expression2)) + is_filter(expression2).then_some((expression1, expression2)) } else { None } diff --git a/src/cli_util.rs b/src/cli_util.rs index cec3cdcaf..cb1ce3a1d 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -795,7 +795,7 @@ impl WorkspaceCommandHelper { .iter() .map(|c| self.format_commit_summary(c)) .join("\n"), - ellipsis = elided.then(|| "\n...").unwrap_or_default() + ellipsis = elided.then_some("\n...").unwrap_or_default() ); Err(user_error_with_hint( format!(r#"Revset "{revision_str}" resolved to more than one revision"#), diff --git a/src/commands/git.rs b/src/commands/git.rs index b1f75cc55..1cfb97df7 100644 --- a/src/commands/git.rs +++ b/src/commands/git.rs @@ -302,7 +302,7 @@ fn cmd_git_fetch( tx.mut_repo(), &git_repo, &remote, - (!branches.is_empty()).then(|| &*branches), + (!branches.is_empty()).then_some(&*branches), cb, &command.settings().git_settings(), ) diff --git a/src/diff_util.rs b/src/diff_util.rs index 23aecc0ff..264ceeb56 100644 --- a/src/diff_util.rs +++ b/src/diff_util.rs @@ -98,7 +98,7 @@ fn diff_formats_from_args(args: &DiffFormatArgs) -> Vec { (args.color_words, DiffFormat::ColorWords), ] .into_iter() - .filter_map(|(arg, format)| arg.then(|| format)) + .filter_map(|(arg, format)| arg.then_some(format)) .collect() } diff --git a/src/ui.rs b/src/ui.rs index 43f53630a..707ab3ef0 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -36,19 +36,14 @@ fn progress_indicator_setting(config: &config::Config) -> bool { config.get_bool("ui.progress-indicator").unwrap_or(true) } -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub enum ColorChoice { Always, Never, + #[default] Auto, } -impl Default for ColorChoice { - fn default() -> Self { - ColorChoice::Auto - } -} - impl FromStr for ColorChoice { type Err = &'static str; @@ -89,18 +84,13 @@ fn use_color(choice: ColorChoice) -> bool { } } -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub enum PaginationChoice { No, + #[default] Auto, } -impl Default for PaginationChoice { - fn default() -> Self { - PaginationChoice::Auto - } -} - fn pager_setting(config: &config::Config) -> CommandNameAndArgs { config .get("ui.pager")