From ed5bb4ac977ab13522fd35e4fdbc47ce74e2f35e Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Tue, 13 Aug 2024 17:32:59 +0800 Subject: [PATCH] fix: ci error --- Cargo.lock | 84 ++----------------- crates/rspack_binding_options/Cargo.toml | 2 +- crates/rspack_glob/Cargo.toml | 4 +- crates/rspack_glob/benches/bench.rs | 5 +- crates/rspack_glob/src/lib.rs | 21 ----- crates/rspack_glob/tests/glob-std.rs | 6 +- .../src/plugin/side_effects_flag_plugin.rs | 2 +- 7 files changed, 15 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee6b7055e5a2..477cc32d2cf1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -212,17 +212,6 @@ dependencies = [ "critical-section", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "auto_impl" version = "1.2.0" @@ -509,18 +498,6 @@ dependencies = [ "half 2.4.1", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "bitflags 1.3.2", - "clap_lex 0.2.4", - "indexmap 1.9.3", - "textwrap 0.16.1", -] - [[package]] name = "clap" version = "4.5.15" @@ -537,16 +514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstyle", - "clap_lex 0.7.2", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", + "clap_lex", ] [[package]] @@ -574,7 +542,7 @@ checksum = "722c36bdc62d9436d027256ce2627af81ac7a596dfc7d13d849d0d212448d7fe" dependencies = [ "codspeed", "colored", - "criterion 0.5.1", + "criterion", ] [[package]] @@ -777,32 +745,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "criterion" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" -dependencies = [ - "anes", - "atty", - "cast", - "ciborium", - "clap 3.2.25", - "criterion-plot", - "itertools 0.10.5", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - [[package]] name = "criterion" version = "0.5.1" @@ -812,7 +754,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.5.15", + "clap", "criterion-plot", "is-terminal", "itertools 0.10.5", @@ -1682,15 +1624,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.2" @@ -1873,7 +1806,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "rustix", "windows-sys 0.48.0", ] @@ -2506,7 +2439,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", ] @@ -2567,12 +2500,6 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - [[package]] name = "outref" version = "0.1.0" @@ -3537,7 +3464,6 @@ name = "rspack_glob" version = "0.1.0" dependencies = [ "codspeed-criterion-compat", - "criterion 0.4.0", "fast-glob", "tempdir", ] diff --git a/crates/rspack_binding_options/Cargo.toml b/crates/rspack_binding_options/Cargo.toml index 86d79da2fd83..d767044ffdb6 100644 --- a/crates/rspack_binding_options/Cargo.toml +++ b/crates/rspack_binding_options/Cargo.toml @@ -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" } diff --git a/crates/rspack_glob/Cargo.toml b/crates/rspack_glob/Cargo.toml index dfa9abec0971..a38e12d5d433 100644 --- a/crates/rspack_glob/Cargo.toml +++ b/crates/rspack_glob/Cargo.toml @@ -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" diff --git a/crates/rspack_glob/benches/bench.rs b/crates/rspack_glob/benches/bench.rs index ff82d6516f5d..ad92c1bf4ba0 100644 --- a/crates/rspack_glob/benches/bench.rs +++ b/crates/rspack_glob/benches/bench.rs @@ -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) } diff --git a/crates/rspack_glob/src/lib.rs b/crates/rspack_glob/src/lib.rs index 579f864336b3..ba4f9b3534c5 100644 --- a/crates/rspack_glob/src/lib.rs +++ b/crates/rspack_glob/src/lib.rs @@ -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()); diff --git a/crates/rspack_glob/tests/glob-std.rs b/crates/rspack_glob/tests/glob-std.rs index f4a8487b657a..2cc1a562cf38 100644 --- a/crates/rspack_glob/tests/glob-std.rs +++ b/crates/rspack_glob/tests/glob-std.rs @@ -10,8 +10,6 @@ // ignore-windows TempDir may cause IoError on windows: #10462 -#![cfg_attr(test, deny(warnings))] - extern crate tempdir; use std::env; @@ -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); @@ -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::>(), diff --git a/crates/rspack_plugin_javascript/src/plugin/side_effects_flag_plugin.rs b/crates/rspack_plugin_javascript/src/plugin/side_effects_flag_plugin.rs index 5f2323d3f0ce..f4460afc7c47 100644 --- a/crates/rspack_plugin_javascript/src/plugin/side_effects_flag_plugin.rs +++ b/crates/rspack_plugin_javascript/src/plugin/side_effects_flag_plugin.rs @@ -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, } } }