Skip to content

Commit

Permalink
fix(cli): Remove unused code
Browse files Browse the repository at this point in the history
- Remove unused fucntions in `cli::test` and `cli::report`.
- Mark functions in `cli::project` as allow(dead_code), these will be required
  once editing is implemented.
  • Loading branch information
tingerrr committed Jul 23, 2024
1 parent 9978403 commit db68f37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
4 changes: 4 additions & 0 deletions crates/typst-test-cli/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl Project {
&self.tests
}

#[allow(dead_code)]
pub fn matched_mut(&mut self) -> &mut BTreeMap<Identifier, Test> {
&mut self.tests
}
Expand All @@ -92,6 +93,7 @@ impl Project {
&self.filtered
}

#[allow(dead_code)]
pub fn filtered_mut(&mut self) -> &mut BTreeMap<Identifier, Test> {
&mut self.filtered
}
Expand Down Expand Up @@ -119,6 +121,7 @@ impl Project {
self.resolver.test_root()
}

#[allow(dead_code)]
pub fn root_exists(&self) -> io::Result<bool> {
self.resolver.project_root().try_exists()
}
Expand All @@ -127,6 +130,7 @@ impl Project {
self.resolver.test_root().try_exists()
}

#[allow(dead_code)]
pub fn unique_test(&self) -> Result<&Test, ()> {
if self.tests.len() != 1 {
return Err(());
Expand Down
9 changes: 0 additions & 9 deletions crates/typst-test-cli/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ impl Summary {
self.passed == self.run()
}

pub fn is_partial_fail(&self) -> bool {
self.passed < self.run()
}

pub fn is_total_fail(&self) -> bool {
self.passed == 0
}
Expand Down Expand Up @@ -200,11 +196,6 @@ impl Reporter {
Ok(())
}

pub fn tests_added(&mut self, project: &Project) -> io::Result<()> {
self.tests_success(project, "added")?;
Ok(())
}

pub fn test_added(&mut self, test: &Test) -> io::Result<()> {
self.test_success(test, "added")?;
Ok(())
Expand Down
9 changes: 0 additions & 9 deletions crates/typst-test-cli/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ pub enum TestFailure {
Comparison(#[from] CompareFailure),
}

impl TestFailure {
pub fn stage(&self) -> Stage {
match self {
TestFailure::Compilation(_) => Stage::Compilation,
TestFailure::Comparison(_) => Stage::Comparison,
}
}
}

#[derive(Debug, Clone, thiserror::Error)]
#[error("compilation failed")]
pub struct CompileFailure {
Expand Down

0 comments on commit db68f37

Please sign in to comment.