Skip to content

Commit

Permalink
fix: ci error
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Aug 13, 2024
1 parent f249ad9 commit 899a022
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 110 deletions.
84 changes: 5 additions & 79 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 crates/rspack_binding_options/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ ignored = ["tracing"]
[dependencies]
async-trait = { workspace = true }
derivative = { workspace = true }
rspack_glob = { version = "0.1.0", path = "../rspack_glob" }
napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow"] }
napi-derive = { workspace = true }
rspack_binding_values = { version = "0.1.0", path = "../rspack_binding_values" }
rspack_collections = { version = "0.1.0", path = "../rspack_collections" }
rspack_core = { version = "0.1.0", path = "../rspack_core" }
rspack_error = { version = "0.1.0", path = "../rspack_error" }
rspack_glob = { version = "0.1.0", path = "../rspack_glob" }
rspack_hook = { version = "0.1.0", path = "../rspack_hook" }
rspack_ids = { version = "0.1.0", path = "../rspack_ids" }
rspack_loader_lightningcss = { version = "0.1.0", path = "../rspack_loader_lightningcss" }
Expand Down
4 changes: 3 additions & 1 deletion crates/rspack_glob/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ name = "rspack_glob"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"

[package.metadata.cargo-shear]
ignored = ["tempdir"]

[dev-dependencies]
codspeed-criterion-compat = "2.6.0"
criterion = "0.4.0"
fast-glob = "0.3.2"
tempdir = "0.3"

Expand Down
5 changes: 3 additions & 2 deletions crates/rspack_glob/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

use codspeed_criterion_compat::{criterion_group, criterion_main, Criterion};

const PATH: &'static str = "some/a/bigger/path/to/the/crazy/needle.txt";
const GLOB: &'static str = "some/**/needle.txt";
const PATH: &str = "some/a/bigger/path/to/the/crazy/needle.txt";
const GLOB: &str = "some/**/needle.txt";

#[inline]
fn rspack_glob(pat: &str, s: &str) -> bool {
#[allow(clippy::unwrap_used)]
let pat = rspack_glob::Pattern::new(pat).unwrap();
pat.matches(s)
}
Expand Down
21 changes: 0 additions & 21 deletions crates/rspack_glob/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,27 +1149,6 @@ mod test {
assert!(glob("abc[def").err().unwrap().pos == 3);
}

// this test assumes that there is a /root directory and that
// the user running this test is not root or otherwise doesn't
// have permission to read its contents
#[cfg(all(unix, not(target_os = "macos")))]
#[test]
fn test_iteration_errors() {
use std::io;
let mut iter = glob("/root/*").unwrap();

// GlobErrors shouldn't halt iteration
let next = iter.next();
assert!(next.is_some());

let err = next.unwrap();
assert!(err.is_err());

let err = err.err().unwrap();
assert!(err.path() == Path::new("/root"));
assert!(err.error().kind() == io::ErrorKind::PermissionDenied);
}

#[test]
fn test_absolute_pattern() {
assert!(glob("/").unwrap().next().is_some());
Expand Down
6 changes: 2 additions & 4 deletions crates/rspack_glob/tests/glob-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

// ignore-windows TempDir may cause IoError on windows: #10462

#![cfg_attr(test, deny(warnings))]

extern crate tempdir;

use std::env;
Expand Down Expand Up @@ -69,7 +67,7 @@ fn main() {
}

let root = TempDir::new("glob-tests");
let root = root.ok().expect("Should have created a temp directory");
let root = root.expect("Should have created a temp directory");
assert!(env::set_current_dir(root.path()).is_ok());

mk_file("aaa", true);
Expand Down Expand Up @@ -148,7 +146,7 @@ fn main() {
if env::consts::FAMILY == "windows" {
let r_verbatim = PathBuf::from("r").canonicalize().unwrap();
assert_eq!(
glob_vec(&format!("{}\\**", r_verbatim.display().to_string()))
glob_vec(&format!("{}\\**", r_verbatim.display()))
.into_iter()
.map(|p| p.strip_prefix(&r_verbatim).unwrap().to_owned())
.collect::<Vec<_>>(),
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_plugin_copy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ version = "0.1.0"
dashmap = { workspace = true }
derivative = { workspace = true }
futures = { workspace = true }
rspack_glob = { version = "0.1.0", path = "../rspack_glob" }
lazy_static = "1.4.0"
pathdiff = { workspace = true }
regex = { workspace = true }
rspack_core = { version = "0.1.0", path = "../rspack_core" }
rspack_error = { version = "0.1.0", path = "../rspack_error" }
rspack_futures = { version = "0.1.0", path = "../rspack_futures" }
rspack_glob = { version = "0.1.0", path = "../rspack_glob" }
rspack_hash = { version = "0.1.0", path = "../rspack_hash" }
rspack_hook = { version = "0.1.0", path = "../rspack_hook" }
rspack_util = { version = "0.1.0", path = "../rspack_util" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn glob_match_with_normalized_pattern(
let pat = entry.insert(pat);
pat.matches(string.trim_start_matches("./"))
}
Err(_) => return false,
Err(_) => false,
}
}
}
Expand Down

0 comments on commit 899a022

Please sign in to comment.