refactor(checks): Implement traits for easier debugging

This commit is contained in:
Ed Page committed 2019-08-08 08:58:36 -05:00
1 parent a2cf3b7cc9
commit 26787df50d
1 file changed
+13
+13
View File
@@ -7,6 +7,7 @@ use crate::report;
use crate::tokens;
use crate::Dictionary;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CheckSettings {
check_filenames: bool,
check_files: bool,
@@ -58,6 +59,7 @@ impl Default for CheckSettings {
}
}
#[derive(Clone)]
pub struct Checks<'d, 'p> {
dictionary: &'d Dictionary,
parser: &'p tokens::Parser,
@@ -170,3 +172,14 @@ impl<'d, 'p> Checks<'d, 'p> {
Ok(typos_found)
}
}
impl std::fmt::Debug for Checks<'_, '_> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
fmt.debug_struct("Checks")
.field("parser", self.parser)
.field("check_filenames", &self.check_filenames)
.field("check_files", &self.check_files)
.field("binary", &self.binary)
.finish()
}
}