Skip to content

Commit

Permalink
chore: upgrade rust to 1.81.0 nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrykingxyz committed Oct 14, 2024
1 parent 69e3bc3 commit 231225f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets -- -D warnings
args: --workspace --all-targets --tests -- -D warnings

- name: Run rustfmt
uses: actions-rs/cargo@v1
Expand Down
1 change: 1 addition & 0 deletions crates/rspack_core/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl miette::Diagnostic for ModuleBuildError {
}

/// Represent any errors or warnings during module parse
///
/// This does NOT aligned with webpack as webpack does not have parse warning.
/// However, rspack may create warning during parsing stage, taking CSS as an example.
#[derive(Debug, Error)]
Expand Down
7 changes: 3 additions & 4 deletions crates/rspack_core/src/options/filename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ impl LocalFilenameFn for NoFilenameFn {

impl From<FilenameTemplate> for Filename {
fn from(value: FilenameTemplate) -> Self {
Self(match value.0 {
FilenameKind::Template(template) => FilenameKind::Template(template),
FilenameKind::Fn(no_fn) => match no_fn.0 {},
})
let FilenameKind::Template(template) = value.0;

Self(FilenameKind::Template(template))
}
}

Expand Down
35 changes: 17 additions & 18 deletions crates/rspack_regex/src/algo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,6 @@ impl Algo {
}
}

#[cfg(test)]
impl Algo {
fn end_with_pats(&self) -> std::collections::HashSet<&str> {
match self {
Algo::EndWith { pats } => pats.iter().map(|s| s.as_str()).collect(),
Algo::Regress(_) => panic!("expect EndWith"),
}
}

fn is_end_with(&self) -> bool {
matches!(self, Self::EndWith { .. })
}

fn is_regress(&self) -> bool {
matches!(self, Self::Regress(..))
}
}

fn is_ends_with_regex(hir: &Hir) -> bool {
if let HirKind::Concat(list) = hir.kind() {
list[0].kind() != &HirKind::Look(Look::Start)
Expand All @@ -143,6 +125,23 @@ fn is_ends_with_regex(hir: &Hir) -> bool {
mod test_algo {
use super::*;

impl Algo {
fn end_with_pats(&self) -> std::collections::HashSet<&str> {
match self {
Algo::EndWith { pats } => pats.iter().map(|s| s.as_str()).collect(),
Algo::Regress(_) => panic!("expect EndWith"),
}
}

fn is_end_with(&self) -> bool {
matches!(self, Self::EndWith { .. })
}

fn is_regress(&self) -> bool {
matches!(self, Self::Regress(..))
}
}

#[test]
fn should_use_end_with_algo_with_i_flag() {
assert!(Algo::new("\\.js$", "").unwrap().is_end_with());
Expand Down
6 changes: 2 additions & 4 deletions crates/rspack_util/src/infallible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ pub trait ResultInfallibleExt {
impl<T> ResultInfallibleExt for Result<T, Infallible> {
type Ok = T;
fn always_ok(self) -> T {
match self {
Ok(ok) => ok,
Err(infallible) => match infallible {},
}
let Ok(ok) = self;
ok
}
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
profile = "default"
# Use nightly for better access to the latest Rust features.
# This date is aligned to stable release dates.
channel = "nightly-2024-06-07" # v1.80.0
channel = "nightly-2024-09-05" # v1.81.0

0 comments on commit 231225f

Please sign in to comment.