Skip to content

Commit

Permalink
Adapt code to Rust 1.84.0 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
PgBiel authored Jan 19, 2025
1 parent 2a140e7 commit f10d3eb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "20"

- name: Install wasm-pack
run: |
Expand Down
21 changes: 10 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler-core/src/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn parse_exact_version(ver: &str) -> Option<Version> {
let first_byte = version.as_bytes().first();

// Version is exact if it starts with an explicit == or a number
if version.starts_with("==") || first_byte.map_or(false, |v| v.is_ascii_digit()) {
if version.starts_with("==") || first_byte.is_some_and(|v| v.is_ascii_digit()) {
let version = version.replace("==", "");
let version = version.as_str().trim();
if let Ok(v) = Version::parse(version) {
Expand Down
2 changes: 1 addition & 1 deletion nix/glistix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ rustPlatform.buildRustPackage {
buildInputs = [ openssl ] ++
lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];

cargoHash = "sha256-/oJSGixb5WKg/OyoUtw6fa1wy/ObxLT8a5VLlZb0kOo=";
cargoHash = "sha256-g7deHhgIUReUEuAc2pk2HMAsGKXkyZrOg0/FArwrlRw=";

meta = with lib; {
description = "A fork of the Gleam compiler with a Nix backend";
Expand Down
8 changes: 3 additions & 5 deletions test-helpers-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use glistix_core::{
};
use itertools::Itertools;
use regex::Regex;
use std::{collections::HashMap, fmt::Write, sync::OnceLock};
use std::{collections::HashMap, fmt::Write, sync::LazyLock};

#[derive(Debug)]
pub struct TestCompileOutput {
Expand Down Expand Up @@ -45,9 +45,6 @@ impl TestCompileOutput {

Content::Text(text) => {
let text = FILE_LINE_REGEX
.get_or_init(|| {
Regex::new(r#"-file\("([^"]+)", (\d+)\)\."#).expect("Invalid regex")
})
.replace_all(text, |caps: &regex::Captures| {
let path = caps
.get(1)
Expand Down Expand Up @@ -95,7 +92,8 @@ pub fn to_in_memory_filesystem(path: &Utf8Path) -> InMemoryFileSystem {
fs
}

static FILE_LINE_REGEX: OnceLock<Regex> = OnceLock::new();
static FILE_LINE_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r#"-file\("([^"]+)", (\d+)\)\."#).expect("Invalid regex"));

pub fn normalise_diagnostic(text: &str) -> String {
// There is an extra ^ on Windows in some error messages' code
Expand Down

0 comments on commit f10d3eb

Please sign in to comment.