Skip to content

Commit

Permalink
refactor(checks): Implement traits for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 8, 2019
1 parent a2cf3b7 commit 26787df
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -58,6 +59,7 @@ impl Default for CheckSettings {
}
}

#[derive(Clone)]
pub struct Checks<'d, 'p> {
dictionary: &'d Dictionary,
parser: &'p tokens::Parser,
Expand Down Expand Up @@ -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()
}
}

0 comments on commit 26787df

Please sign in to comment.