From b15433588b5bbcb1b67b1613bd5745f2df792e3a Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Tue, 14 Nov 2023 11:11:23 +0100 Subject: [PATCH 1/2] Also run clippy on examples This PR also fixes existing clippy lints --- .github/workflows/ci.yml | 2 +- examples/cwd_aware_hinter.rs | 4 ++-- examples/transient_prompt.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43f6764b..0d07bedd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: run: cargo fmt --all -- --check - name: Clippy - run: cargo clippy ${{ matrix.flags }} --all -- -D warnings + run: cargo clippy ${{ matrix.flags }} --examples --all -- -D warnings - name: Tests diff --git a/examples/cwd_aware_hinter.rs b/examples/cwd_aware_hinter.rs index 1e3d1010..b8b9145d 100644 --- a/examples/cwd_aware_hinter.rs +++ b/examples/cwd_aware_hinter.rs @@ -52,8 +52,8 @@ fn main() -> io::Result<()> { let home_dir = std::env::home_dir().unwrap(); let history = create_filled_example_history( - &home_dir.to_string_lossy().to_string(), - &orig_dir.to_string_lossy().to_string(), + home_dir.to_string_lossy().as_ref(), + orig_dir.to_string_lossy().as_ref(), ); let mut line_editor = Reedline::create() diff --git a/examples/transient_prompt.rs b/examples/transient_prompt.rs index 7d270a7c..f971955b 100644 --- a/examples/transient_prompt.rs +++ b/examples/transient_prompt.rs @@ -61,7 +61,7 @@ struct CustomValidator; impl Validator for CustomValidator { fn validate(&self, line: &str) -> ValidationResult { - if line.ends_with("\\") { + if line.ends_with('\\') { ValidationResult::Incomplete } else { ValidationResult::Complete From 4a98ac6e3f80586a31767377616a2eebe14a86c8 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Tue, 14 Nov 2023 11:38:43 +0100 Subject: [PATCH 2/2] Update .github/workflows/ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d07bedd..4b8ba02d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: run: cargo fmt --all -- --check - name: Clippy - run: cargo clippy ${{ matrix.flags }} --examples --all -- -D warnings + run: cargo clippy ${{ matrix.flags }} --all-targets --all -- -D warnings - name: Tests