mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 15:42:23 -05:00
refactor(checks): Implement traits for easier debugging
This commit is contained in:
parent
a2cf3b7cc9
commit
26787df50d
1 changed files with 13 additions and 0 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue