Skip to content

Commit e139d9c

Browse files
committed
fix clippy lints
and make CI fail on lint warnings
1 parent cfddeb8 commit e139d9c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.github/workflows/pre-commit-hooks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
path: ~/.cargo
2727
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
2828
- name: cargo clippy
29-
run: cargo clippy
29+
run: cargo clippy -- -D warnings
3030
- name: cargo fmt
3131
run: cargo fmt --check
3232

cpp-linter/src/clang_tools/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ pub fn get_clang_tool_exe(name: &str, version: &str) -> Result<PathBuf> {
6565
// On Unix systems, this block is not likely reached. Typically, installing clang
6666
// will produce a symlink to the executable with the major version appended to the
6767
// name.
68-
return Ok(cmd);
68+
Ok(cmd)
6969
} else {
70-
return Err(anyhow!("Could not find clang tool by name and version"));
70+
Err(anyhow!("Could not find clang tool by name and version"))
7171
}
7272
} else {
7373
// `version` specified is not a semantic version; treat as path/to/bin

cpp-linter/src/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn get_sha(repo: &Repository, depth: Option<u32>) -> Result<git2::Object<'_>, Er
4949
/// If there are files staged for a commit, then the resulting [`Diff`] will describe
5050
/// the staged changes. However, if there are no staged changes, then the last commit's
5151
/// [`Diff`] is returned.
52-
pub fn get_diff(repo: &Repository) -> Result<git2::Diff> {
52+
pub fn get_diff(repo: &'_ Repository) -> Result<git2::Diff<'_>> {
5353
let head = get_sha(repo, None).unwrap().peel_to_tree().unwrap();
5454
let mut has_staged_files = false;
5555
for entry in repo.statuses(None).unwrap().iter() {

0 commit comments

Comments
 (0)