diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f97ca3707..79efc24697 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,10 @@ jobs: - name: Clippy run: cargo clippy --workspace ${{ matrix.flags }} --exclude nu_plugin_* -- $CLIPPY_OPTIONS + + # In tests we don't have to deny unwrap + - name: Clippy of tests + run: cargo clippy --tests --workspace ${{ matrix.flags }} --exclude nu_plugin_* -- -D warnings tests: strategy: diff --git a/crates/nu-command/tests/commands/parse.rs b/crates/nu-command/tests/commands/parse.rs index e01f26d1a8..93a2b395da 100644 --- a/crates/nu-command/tests/commands/parse.rs +++ b/crates/nu-command/tests/commands/parse.rs @@ -215,9 +215,7 @@ mod regex { #[test] fn parse_handles_external_stream_chunking() { Playground::setup("parse_test_streaming_1", |dirs, sandbox| { - let data: String = std::iter::repeat("abcdefghijklmnopqrstuvwxyz") - .take(1000) - .collect(); + let data: String = "abcdefghijklmnopqrstuvwxyz".repeat(1000); sandbox.with_files(vec![Stub::FileWithContent("data.txt", &data)]); let actual = nu!( diff --git a/src/tests/test_config_path.rs b/src/tests/test_config_path.rs index ba8db85296..dd15396b35 100644 --- a/src/tests/test_config_path.rs +++ b/src/tests/test_config_path.rs @@ -12,8 +12,8 @@ fn adjust_canonicalization>(p: P) -> String { fn adjust_canonicalization>(p: P) -> String { const VERBATIM_PREFIX: &str = r#"\\?\"#; let p = p.as_ref().display().to_string(); - if p.starts_with(VERBATIM_PREFIX) { - p[VERBATIM_PREFIX.len()..].to_string() + if let Some(stripped) = p.strip_prefix(VERBATIM_PREFIX) { + stripped.to_string() } else { p }