diff --git a/.clippy.toml b/.clippy.toml index 7c7c792b85..3d894c832e 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,2 +1,2 @@ -msrv = "1.70.0" +msrv = "1.81.0" cognitive-complexity-threshold = 18 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4349fa3e90..57a9e664cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - rust: [nightly, stable, '1.70'] + rust: [nightly, stable, '1.81'] runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.rust == 'nightly' }} @@ -41,6 +41,9 @@ jobs: toolchain: ${{ matrix.rust }} components: clippy + - name: Override rust toolchain + run: rustup override set ${{ matrix.rust }} + - name: Rustup Show run: rustup show @@ -89,7 +92,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [nightly, stable, '1.70'] + rust: [nightly, stable, '1.81'] continue-on-error: ${{ matrix.rust == 'nightly' }} steps: - uses: actions/checkout@v4 @@ -112,6 +115,12 @@ jobs: - name: Manually install target run: rustup target add x86_64-unknown-linux-musl + - name: Override rust toolchain + run: rustup override set ${{ matrix.rust }} + + - name: Rustup Show + run: rustup show + - name: Setup MUSL run: | sudo apt-get -qq install musl-tools @@ -135,7 +144,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [nightly, stable, '1.70'] + rust: [nightly, stable, '1.81'] continue-on-error: ${{ matrix.rust == 'nightly' }} steps: - uses: actions/checkout@v4 @@ -151,6 +160,10 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} + + - name: Override rust toolchain + run: rustup override set ${{ matrix.rust }} + - name: Setup ARM toolchain run: | rustup target add aarch64-unknown-linux-gnu @@ -166,6 +179,9 @@ jobs: echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin" >> $GITHUB_PATH echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin" >> $GITHUB_PATH + - name: Rustup Show + run: rustup show + - name: Build Debug run: | make build-linux-arm-debug @@ -179,7 +195,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [nightly, stable, '1.70'] + rust: [nightly, stable, '1.81'] continue-on-error: ${{ matrix.rust == 'nightly' }} steps: - uses: actions/checkout@v4 @@ -195,9 +211,16 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} + + - name: Override rust toolchain + run: rustup override set ${{ matrix.rust }} + - name: Setup target run: rustup target add x86_64-apple-darwin + - name: Rustup Show + run: rustup show + - name: Build Debug run: | make build-apple-x86-debug diff --git a/CHANGELOG.md b/CHANGELOG.md index 47231d74b1..a8fe41fdd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * add `use_selection_fg` to theme file to allow customizing selection foreground color [[@Upsylonbare](https://github.com/Upsylonbare)] ([#2515](https://github.com/gitui-org/gitui/pull/2515)) ### Changed +* increase MSRV from 1.70 to 1.81 [[@naseschwarz](https://github.com/naseschwarz)] ([#2094](https://github.com/gitui-org/gitui/issues/2094)) * improve syntax highlighting file detection [[@acuteenvy](https://github.com/acuteenvy)] ([#2524](https://github.com/extrawurst/gitui/pull/2524)) * Updated project links to point to `gitui-org` instead of `extrawurst` [[@vasleymus](https://github.com/vasleymus)] ([#2538](https://github.com/gitui-org/gitui/pull/2538)) * After commit: jump back to unstaged area [[@tommady](https://github.com/tommady)] ([#2476](https://github.com/extrawurst/gitui/issues/2476)) diff --git a/Cargo.toml b/Cargo.toml index 8d5b5e2fad..ae7b777f08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.27.0" authors = ["extrawurst "] description = "blazing fast terminal-ui for git" edition = "2021" -rust-version = "1.70" +rust-version = "1.81" exclude = [".github/*", ".vscode/*", "assets/*"] homepage = "https://github.com/gitui-org/gitui" repository = "https://github.com/gitui-org/gitui" diff --git a/README.md b/README.md index 4b8b90e7d6..dd4270d6ed 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ see [NIGHTLIES.md](./NIGHTLIES.md) ### Requirements -- Minimum supported `rust`/`cargo` version: `1.70` +- Minimum supported `rust`/`cargo` version: `1.81` - See [Install Rust](https://www.rust-lang.org/tools/install) - To build openssl dependency (see https://docs.rs/openssl/latest/openssl/) diff --git a/asyncgit/src/sync/branch/mod.rs b/asyncgit/src/sync/branch/mod.rs index 66e47aa65b..81ec2ec586 100644 --- a/asyncgit/src/sync/branch/mod.rs +++ b/asyncgit/src/sync/branch/mod.rs @@ -701,7 +701,7 @@ mod tests_branches { &root.as_os_str().to_str().unwrap().into(); let upstream_merge_res = - get_branch_upstream_merge(&repo_path, "master"); + get_branch_upstream_merge(repo_path, "master"); assert!( upstream_merge_res.is_ok_and(|v| v.as_ref().is_none()) ); @@ -721,12 +721,12 @@ mod tests_branches { config .set_str( &format!("branch.{branch_name}.merge"), - &upstrem_merge, + upstrem_merge, ) .expect("fail set branch merge config"); let upstream_merge_res = - get_branch_upstream_merge(&repo_path, &branch_name); + get_branch_upstream_merge(repo_path, branch_name); assert!(upstream_merge_res .as_ref() .is_ok_and(|v| v.as_ref().is_some())); diff --git a/asyncgit/src/sync/hooks.rs b/asyncgit/src/sync/hooks.rs index b78f25d9e9..111b426259 100644 --- a/asyncgit/src/sync/hooks.rs +++ b/asyncgit/src/sync/hooks.rs @@ -230,11 +230,8 @@ mod tests { create_hook_in_path(&hooks_folder.join("commit-msg"), hook); let mut msg = String::from("test"); - let res = hooks_commit_msg( - &hooks_folder.to_path_buf().into(), - &mut msg, - ) - .unwrap(); + let res = + hooks_commit_msg(&hooks_folder.into(), &mut msg).unwrap(); assert_eq!( res, HookResult::NotOk(String::from("rejected\n")) diff --git a/asyncgit/src/sync/remotes/push.rs b/asyncgit/src/sync/remotes/push.rs index 707f7572ad..0916bfdc91 100644 --- a/asyncgit/src/sync/remotes/push.rs +++ b/asyncgit/src/sync/remotes/push.rs @@ -290,7 +290,7 @@ mod tests { // Attempt force push, // should work as it forces the push through - assert!(!push_branch( + assert!(push_branch( &tmp_other_repo_dir.path().to_str().unwrap().into(), "origin", "master", @@ -299,7 +299,7 @@ mod tests { None, None, ) - .is_err()); + .is_ok()); } #[test] diff --git a/asyncgit/src/sync/stash.rs b/asyncgit/src/sync/stash.rs index c496168116..8a65f92feb 100644 --- a/asyncgit/src/sync/stash.rs +++ b/asyncgit/src/sync/stash.rs @@ -144,7 +144,7 @@ mod tests { let repo_path: &RepoPath = &root.as_os_str().to_str().unwrap().into(); - assert!(!stash_save(repo_path, None, true, false).is_ok()); + assert!(stash_save(repo_path, None, true, false).is_err()); assert!(get_stashes(repo_path).unwrap().is_empty()); } diff --git a/asyncgit/src/sync/utils.rs b/asyncgit/src/sync/utils.rs index 8e767bbfd4..ebae31beb0 100644 --- a/asyncgit/src/sync/utils.rs +++ b/asyncgit/src/sync/utils.rs @@ -242,7 +242,7 @@ mod tests { let root = repo.path().parent().unwrap(); let repo_path = root.as_os_str().to_str().unwrap(); - assert!(!stage_add_file(&repo_path.into(), file_path).is_ok()); + assert!(stage_add_file(&repo_path.into(), file_path).is_err()); } #[test] @@ -440,7 +440,7 @@ mod tests { let repo_path: &RepoPath = &root.as_os_str().to_str().unwrap().into(); - assert!(!get_head(repo_path).is_ok()); + assert!(get_head(repo_path).is_err()); Ok(()) } diff --git a/git2-hooks/src/hookspath.rs b/git2-hooks/src/hookspath.rs index 1518bfd76f..a601b159c2 100644 --- a/git2-hooks/src/hookspath.rs +++ b/git2-hooks/src/hookspath.rs @@ -331,8 +331,8 @@ mod test { fn test_hookspath_relative() { assert_eq!( HookPaths::expand_path( - &Path::new("pre-commit"), - &Path::new("example_git_root"), + Path::new("pre-commit"), + Path::new("example_git_root"), ) .unwrap(), Path::new("example_git_root").join("pre-commit") @@ -346,7 +346,7 @@ mod test { assert_eq!( HookPaths::expand_path( &absolute_hook, - &Path::new("example_git_root"), + Path::new("example_git_root"), ) .unwrap(), absolute_hook diff --git a/src/args.rs b/src/args.rs index 8ef3aeb42f..6c09317314 100644 --- a/src/args.rs +++ b/src/args.rs @@ -139,7 +139,7 @@ fn setup_logging(path_override: Option) -> Result<()> { path }; - println!("Logging enabled. Log written to: {path:?}"); + println!("Logging enabled. Log written to: {}", path.display()); WriteLogger::init( LevelFilter::Trace, diff --git a/src/components/commitlist.rs b/src/components/commitlist.rs index d45bec1739..dde38ba06e 100644 --- a/src/components/commitlist.rs +++ b/src/components/commitlist.rs @@ -488,24 +488,36 @@ impl CommitList { txt.push(splitter.clone()); } - let style_hash = normal - .then(|| theme.commit_hash(selected)) - .unwrap_or_else(|| theme.commit_unhighlighted()); - let style_time = normal - .then(|| theme.commit_time(selected)) - .unwrap_or_else(|| theme.commit_unhighlighted()); - let style_author = normal - .then(|| theme.commit_author(selected)) - .unwrap_or_else(|| theme.commit_unhighlighted()); - let style_tags = normal - .then(|| theme.tags(selected)) - .unwrap_or_else(|| theme.commit_unhighlighted()); - let style_branches = normal - .then(|| theme.branch(selected, true)) - .unwrap_or_else(|| theme.commit_unhighlighted()); - let style_msg = normal - .then(|| theme.text(true, selected)) - .unwrap_or_else(|| theme.commit_unhighlighted()); + let style_hash = if normal { + theme.commit_hash(selected) + } else { + theme.commit_unhighlighted() + }; + let style_time = if normal { + theme.commit_time(selected) + } else { + theme.commit_unhighlighted() + }; + let style_author = if normal { + theme.commit_author(selected) + } else { + theme.commit_unhighlighted() + }; + let style_tags = if normal { + theme.tags(selected) + } else { + theme.commit_unhighlighted() + }; + let style_branches = if normal { + theme.branch(selected, true) + } else { + theme.commit_unhighlighted() + }; + let style_msg = if normal { + theme.text(true, selected) + } else { + theme.commit_unhighlighted() + }; // commit hash txt.push(Span::styled(Cow::from(&*e.hash_short), style_hash)); @@ -898,7 +910,7 @@ mod tests { impl Default for CommitList { fn default() -> Self { Self { - title: String::from("").into_boxed_str(), + title: String::new().into_boxed_str(), selection: 0, highlighted_selection: Option::None, highlights: Option::None,