From 9df84147f608858b09004c23694e8813d2d0c135 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 28 Oct 2024 11:05:00 +0100 Subject: [PATCH] Search with LemmyErrorType prefix --- crates/utils/src/error.rs | 1 - crates/utils/tests/test_errors_used.rs | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index 1f29bf589..c95af03e2 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -38,7 +38,6 @@ pub enum LemmyErrorType { NotHigherAdmin, SiteBan, Deleted, - BannedFromCommunity, PersonIsBlocked, CommunityIsBlocked, InstanceIsBlocked, diff --git a/crates/utils/tests/test_errors_used.rs b/crates/utils/tests/test_errors_used.rs index 81b92e469..d0dec489a 100644 --- a/crates/utils/tests/test_errors_used.rs +++ b/crates/utils/tests/test_errors_used.rs @@ -10,12 +10,13 @@ fn test_errors_used() { current_dir.pop(); current_dir.pop(); for error in LemmyErrorType::iter() { + let search = format!("LemmyErrorType::{error}"); let mut grep_all = Command::new("grep"); let grep_all = grep_all .current_dir(current_dir.clone()) .arg("-R") .arg("--exclude=error.rs") - .arg(error.to_string()) + .arg(&search) .arg("crates/") .arg("src/"); let output = grep_all.output().unwrap(); @@ -26,7 +27,7 @@ fn test_errors_used() { .current_dir(current_dir.clone()) .arg("-R") .arg("--exclude-dir=api") - .arg(error.to_string()) + .arg(&search) .arg("crates/apub/"); let output = grep_apub.output().unwrap(); let grep_apub_out = std::str::from_utf8(&output.stdout).unwrap(); @@ -35,7 +36,7 @@ fn test_errors_used() { println!("LemmyErrorType::{} is unused", error); unused_error_found = true; } - if grep_all_out == grep_apub_out { + if search != "LemmyErrorType::FederationError" && grep_all_out == grep_apub_out { println!("LemmyErrorType::{} is only used for federation", error); unused_error_found = true; }