Skip to content

Commit f253148

Browse files
authored
Upgrade to edition 2024 (#121)
1 parent 3660c41 commit f253148

File tree

9 files changed

+91
-112
lines changed

9 files changed

+91
-112
lines changed

Cargo.lock

Lines changed: 76 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "restack"
33
version = "0.8.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Teaches git rebase --interactive about your branches."
66
homepage = "https://github.com/abhinav/restack"
77
documentation = "https://github.com/abhinav/restack/blob/main/README.md"

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.81.0
1+
1.86.0

src/edit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::borrow::Cow;
44
use std::{env, fs, path, process};
55

6-
use anyhow::{anyhow, bail, Context, Result};
6+
use anyhow::{Context, Result, anyhow, bail};
77

88
use crate::exec::ExitStatusExt;
99
use crate::{git, restack};

src/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::io::{self, Read};
55
use std::{ffi, fs, path};
66

7-
use anyhow::{bail, Context, Result};
7+
use anyhow::{Context, Result, bail};
88

99
mod shell;
1010

src/git/shell.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl Git for Shell {
142142
},
143143
};
144144

145-
return match output.as_str() {
145+
match output.as_str() {
146146
// In auto, git will pick an unused character from a pre-defined list.
147147
// This might be useful to support in the future.
148148
"auto" => anyhow::bail!(
@@ -155,7 +155,7 @@ impl Git for Shell {
155155
"" => Ok("#".to_string()),
156156

157157
_ => Ok(output),
158-
};
158+
}
159159
}
160160
}
161161

@@ -203,10 +203,12 @@ mod tests {
203203
// This is hacky but it's the only way to prevent
204204
// any other environment variables from leaking
205205
// into the Git subprocess
206-
std::env::vars().for_each(|(k, _)| {
207-
std::env::remove_var(k);
208-
});
209-
std::env::set_var("HOME", home);
206+
unsafe {
207+
std::env::vars().for_each(|(k, _)| {
208+
std::env::remove_var(k);
209+
});
210+
std::env::set_var("HOME", home);
211+
}
210212

211213
let shell = Shell::new();
212214
shell.set_global_config_str("user.name", "Test User")?;

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
#![warn(missing_docs)]
1616

17-
use anyhow::{anyhow, bail, Result};
17+
use anyhow::{Result, anyhow, bail};
1818

1919
mod edit;
2020
mod exec;

src/restack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct Restack<'a, O: io::Write> {
115115
wrote_push: bool,
116116
}
117117

118-
impl<'a, O: io::Write> Restack<'a, O> {
118+
impl<O: io::Write> Restack<'_, O> {
119119
pub fn process(&mut self, line: &str) -> Result<()> {
120120
if line.is_empty() {
121121
// Empty lines delineate sections.

tools/test/src/gitscript.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub struct Fixture<'a> {
6969
version: Cow<'a, str>,
7070
}
7171

72-
impl<'a> Debug for Fixture<'a> {
72+
impl Debug for Fixture<'_> {
7373
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7474
f.debug_struct("Fixture")
7575
.field("tempdir", &self.tempdir.path())

0 commit comments

Comments
 (0)