From 1dec32c37ac2f563e164021c9f21052f11fd1d20 Mon Sep 17 00:00:00 2001 From: Michael Gattozzi Date: Mon, 9 Dec 2019 17:42:08 -0500 Subject: Make the pre-commit script pedantic and fix errors This commit really ups the level and quality of the Rust code by setting clippy to pedantic mode. It also fixes an issue where bash continued to run scripts even if something failed with a non-zero exit status. We also deny all warnings so as to actually fail the builds and the commit hooks. This should make sure code quality stays at a high level. --- shared/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shared') diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 138e8d0..db28822 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -1,3 +1,5 @@ +//! Common functionality needed in many of the tools + use anyhow::{ bail, Result, @@ -7,6 +9,7 @@ use std::{ path::PathBuf, }; +/// Finds the top level folder of the repo and returns it's canonicalized path pub fn find_root() -> Result { let mut location = env::current_dir()?; let mut found_root = false; @@ -14,7 +17,7 @@ pub fn find_root() -> Result { for loc in location.ancestors() { let mut loc = loc.join(".git"); if loc.exists() { - loc.pop(); + let _ = loc.pop(); found_root = true; location = loc.canonicalize()?; break; -- cgit v1.2.3