Skip to content

Commit ffd4f34

Browse files
GearsDatapackslpil
authored andcommitted
Fix clippy warnings
1 parent 9f80f66 commit ffd4f34

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ jobs:
286286

287287
- uses: actions/setup-node@v4
288288
with:
289-
node-version: "18"
289+
node-version: "20"
290290

291291
- name: Install wasm-pack
292292
run: |

compiler-core/src/dependency.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn parse_exact_version(ver: &str) -> Option<Version> {
6969
let first_byte = version.as_bytes().first();
7070

7171
// Version is exact if it starts with an explicit == or a number
72-
if version.starts_with("==") || first_byte.map_or(false, |v| v.is_ascii_digit()) {
72+
if version.starts_with("==") || first_byte.is_some_and(|v| v.is_ascii_digit()) {
7373
let version = version.replace("==", "");
7474
let version = version.as_str().trim();
7575
if let Ok(v) = Version::parse(version) {

compiler-core/src/language_server/code_action.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,7 @@ impl<'a> DesugarUse<'a> {
22962296

22972297
// If there's arguments on the left hand side of the function we extract
22982298
// those so we can paste them back as the anonymous function arguments.
2299-
let assignments = if type_.fn_arity().map_or(false, |arity| arity >= 1) {
2299+
let assignments = if type_.fn_arity().is_some_and(|arity| arity >= 1) {
23002300
let assignments_range =
23012301
use_.assignments_location.start as usize..use_.assignments_location.end as usize;
23022302
self.module

test-helpers-rs/src/lib.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use gleam_core::{
55
};
66
use itertools::Itertools;
77
use regex::Regex;
8-
use std::{collections::HashMap, fmt::Write, sync::OnceLock};
8+
use std::{collections::HashMap, fmt::Write, sync::LazyLock};
99

1010
#[derive(Debug)]
1111
pub struct TestCompileOutput {
@@ -45,9 +45,6 @@ impl TestCompileOutput {
4545

4646
Content::Text(text) => {
4747
let text = FILE_LINE_REGEX
48-
.get_or_init(|| {
49-
Regex::new(r#"-file\("([^"]+)", (\d+)\)\."#).expect("Invalid regex")
50-
})
5148
.replace_all(text, |caps: &regex::Captures| {
5249
let path = caps
5350
.get(1)
@@ -95,7 +92,8 @@ pub fn to_in_memory_filesystem(path: &Utf8Path) -> InMemoryFileSystem {
9592
fs
9693
}
9794

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

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

0 commit comments

Comments
 (0)