mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-28 20:31:24 +00:00
Search with LemmyErrorType prefix
This commit is contained in:
parent
6619d8390f
commit
9df84147f6
2 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,6 @@ pub enum LemmyErrorType {
|
|||
NotHigherAdmin,
|
||||
SiteBan,
|
||||
Deleted,
|
||||
BannedFromCommunity,
|
||||
PersonIsBlocked,
|
||||
CommunityIsBlocked,
|
||||
InstanceIsBlocked,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue