mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 12:21:18 +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,
|
NotHigherAdmin,
|
||||||
SiteBan,
|
SiteBan,
|
||||||
Deleted,
|
Deleted,
|
||||||
BannedFromCommunity,
|
|
||||||
PersonIsBlocked,
|
PersonIsBlocked,
|
||||||
CommunityIsBlocked,
|
CommunityIsBlocked,
|
||||||
InstanceIsBlocked,
|
InstanceIsBlocked,
|
||||||
|
|
|
@ -10,12 +10,13 @@ fn test_errors_used() {
|
||||||
current_dir.pop();
|
current_dir.pop();
|
||||||
current_dir.pop();
|
current_dir.pop();
|
||||||
for error in LemmyErrorType::iter() {
|
for error in LemmyErrorType::iter() {
|
||||||
|
let search = format!("LemmyErrorType::{error}");
|
||||||
let mut grep_all = Command::new("grep");
|
let mut grep_all = Command::new("grep");
|
||||||
let grep_all = grep_all
|
let grep_all = grep_all
|
||||||
.current_dir(current_dir.clone())
|
.current_dir(current_dir.clone())
|
||||||
.arg("-R")
|
.arg("-R")
|
||||||
.arg("--exclude=error.rs")
|
.arg("--exclude=error.rs")
|
||||||
.arg(error.to_string())
|
.arg(&search)
|
||||||
.arg("crates/")
|
.arg("crates/")
|
||||||
.arg("src/");
|
.arg("src/");
|
||||||
let output = grep_all.output().unwrap();
|
let output = grep_all.output().unwrap();
|
||||||
|
@ -26,7 +27,7 @@ fn test_errors_used() {
|
||||||
.current_dir(current_dir.clone())
|
.current_dir(current_dir.clone())
|
||||||
.arg("-R")
|
.arg("-R")
|
||||||
.arg("--exclude-dir=api")
|
.arg("--exclude-dir=api")
|
||||||
.arg(error.to_string())
|
.arg(&search)
|
||||||
.arg("crates/apub/");
|
.arg("crates/apub/");
|
||||||
let output = grep_apub.output().unwrap();
|
let output = grep_apub.output().unwrap();
|
||||||
let grep_apub_out = std::str::from_utf8(&output.stdout).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);
|
println!("LemmyErrorType::{} is unused", error);
|
||||||
unused_error_found = true;
|
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);
|
println!("LemmyErrorType::{} is only used for federation", error);
|
||||||
unused_error_found = true;
|
unused_error_found = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue