Skip to content

Commit bc4d19a

Browse files
authored
upgrade toolchain to rust 1.88 (#1441)
* update rust versions * run cargo clippy --fix * changeset * update action * update zig installation * use mlugg/setup-zig@v2 * maybe we can drop zigbuild? no time to debug this
1 parent b6806f0 commit bc4d19a

File tree

16 files changed

+49
-38
lines changed

16 files changed

+49
-38
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"fnm": patch
3+
---
4+
5+
bump Rust toolchain to 1.88

.github/workflows/rust.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
env:
14-
RUST_VERSION: "1.81"
14+
RUST_VERSION: "1.88"
1515

1616
jobs:
1717
fmt:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: hecrj/setup-rust-action@v1
20+
- uses: hecrj/setup-rust-action@v2
2121
with:
2222
rust-version: ${{env.RUST_VERSION}}
2323
- uses: Swatinem/rust-cache@v2
@@ -28,7 +28,7 @@ jobs:
2828
clippy:
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: hecrj/setup-rust-action@v1
31+
- uses: hecrj/setup-rust-action@v2
3232
with:
3333
rust-version: ${{env.RUST_VERSION}}
3434
- uses: Swatinem/rust-cache@v2
@@ -42,7 +42,7 @@ jobs:
4242
matrix:
4343
os: [ubuntu-latest, macOS-latest, windows-latest]
4444
steps:
45-
- uses: hecrj/setup-rust-action@v1
45+
- uses: hecrj/setup-rust-action@v2
4646
with:
4747
rust-version: ${{env.RUST_VERSION}}
4848
- uses: Swatinem/rust-cache@v2
@@ -54,7 +54,7 @@ jobs:
5454
runs-on: windows-latest
5555
name: "Release build for Windows"
5656
steps:
57-
- uses: hecrj/setup-rust-action@v1
57+
- uses: hecrj/setup-rust-action@v2
5858
with:
5959
rust-version: ${{env.RUST_VERSION}}
6060
- uses: Swatinem/rust-cache@v2
@@ -72,19 +72,26 @@ jobs:
7272
runs-on: macos-latest
7373
name: "Release build for macOS"
7474
steps:
75-
- uses: hecrj/setup-rust-action@v1
75+
- uses: hecrj/setup-rust-action@v2
7676
with:
7777
rust-version: ${{env.RUST_VERSION}}
7878
targets: x86_64-apple-darwin,aarch64-apple-darwin
7979
- uses: Swatinem/rust-cache@v2
80-
- uses: mlugg/setup-zig@v1
81-
- run: cargo install --locked cargo-zigbuild
8280
- uses: actions/checkout@v4
8381
- name: Build release binary
8482
run: |
85-
cargo zigbuild --release --target=universal2-apple-darwin
83+
cargo build --release --target x86_64-apple-darwin
84+
strip target/x86_64-apple-darwin/release/fnm
85+
cargo build --release --target aarch64-apple-darwin
86+
strip target/aarch64-apple-darwin/release/fnm
87+
8688
mkdir -p target/release
87-
cp target/universal2-apple-darwin/release/fnm target/release/fnm
89+
90+
# create a universal binary
91+
lipo -create \
92+
target/x86_64-apple-darwin/release/fnm \
93+
target/aarch64-apple-darwin/release/fnm \
94+
-output target/release/fnm
8895
env:
8996
LZMA_API_STATIC: "true"
9097
- name: Strip binary from debug symbols
@@ -245,7 +252,7 @@ jobs:
245252
name: "Build static Linux binary"
246253
runs-on: ubuntu-latest
247254
steps:
248-
- uses: hecrj/setup-rust-action@v1
255+
- uses: hecrj/setup-rust-action@v2
249256
with:
250257
rust-version: ${{env.RUST_VERSION}}
251258
targets: x86_64-unknown-linux-musl
@@ -286,7 +293,7 @@ jobs:
286293
- name: Set up QEMU
287294
id: qemu
288295
uses: docker/setup-qemu-action@v3
289-
- uses: hecrj/setup-rust-action@v1
296+
- uses: hecrj/setup-rust-action@v2
290297
with:
291298
rust-version: ${{env.RUST_VERSION}}
292299
- uses: Swatinem/rust-cache@v2

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.81"
2+
channel = "1.88"
33
components = ["rustfmt", "clippy"]

src/commands/completions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Command for Completions {
2121
let shell: Box<dyn Shell> = self
2222
.shell
2323
.map(Into::into)
24-
.or_else(|| infer_shell().map(Into::into))
24+
.or_else(|| infer_shell())
2525
.ok_or(Error::CantInferShell)?;
2626
let shell: ClapShell = shell.into();
2727
let mut app = Cli::command();

src/commands/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl Command for Install {
149149
}
150150
Err(source) => Err(Error::DownloadError { source })?,
151151
Ok(()) => {}
152-
};
152+
}
153153

154154
if !config.default_version_dir().exists() {
155155
debug!("Tagging {} as the default version", version.v_str().cyan());

src/commands/ls_remote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl super::command::Command for LsRemote {
6161
.is_some_and(|v_lts| v_lts.eq_ignore_ascii_case(codename))
6262
}),
6363
None => all_versions.retain(|v| v.lts.is_some()),
64-
};
64+
}
6565
}
6666

6767
if let Some(filter) = &self.filter {

src/installed_versions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn list<P: AsRef<Path>>(installations_dir: P) -> Result<Vec<Version>, Error>
99
if entry
1010
.file_name()
1111
.to_str()
12-
.map_or(false, |s| s.starts_with('.'))
12+
.is_some_and(|s| s.starts_with('.'))
1313
{
1414
continue;
1515
}

src/lts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ impl LtsType {
3434
versions: &'vec [IndexedNodeVersion],
3535
) -> Option<&'vec IndexedNodeVersion> {
3636
match self {
37-
Self::Latest => versions.iter().filter(|x| x.lts.is_some()).last(),
37+
Self::Latest => versions.iter().filter(|x| x.lts.is_some()).next_back(),
3838
Self::CodeName(s) => versions
3939
.iter()
4040
.filter(|x| match &x.lts {
4141
None => false,
4242
Some(x) => s.to_lowercase() == x.to_lowercase(),
4343
})
44-
.last(),
44+
.next_back(),
4545
}
4646
}
4747
}

src/remote_node_index.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ pub enum Error {
8484
pub fn list(base_url: &Url) -> Result<Vec<IndexedNodeVersion>, Error> {
8585
let base_url = base_url.as_str().trim_end_matches('/');
8686
let index_json_url = format!("{base_url}/index.json");
87-
let resp = crate::http::get(&index_json_url)
88-
.map_err(crate::http::Error::from)?
87+
let resp = crate::http::get(&index_json_url)?
8988
.error_for_status()
9089
.map_err(crate::http::Error::from)?;
9190
let text = resp.text().map_err(crate::http::Error::from)?;

src/shell/bash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ impl Shell for Bash {
3333
};
3434
let autoload_hook = match config.version_file_strategy() {
3535
VersionFileStrategy::Local => formatdoc!(
36-
r#"
36+
r"
3737
if [[ {version_file_exists_condition} ]]; then
3838
fnm use --silent-if-unchanged
3939
fi
40-
"#,
40+
",
4141
version_file_exists_condition = version_file_exists_condition,
4242
),
4343
VersionFileStrategy::Recursive => String::from(r"fnm use --silent-if-unchanged"),

0 commit comments

Comments
 (0)