hive-forge: move the lint test module to the end of the file

clippy::items_after_test_module (pedantic, denied) — a #[cfg(test)] mod
has to be the last item in its file. Pure move: same line count, same
line multiset, no content change.

`cargo test` was green while this was broken; only clippy saw it.
This commit is contained in:
atlas 2026-09-02 11:22:42 +02:00
commit b0507a0936

View file

@ -497,6 +497,36 @@ fn num(it: &Value) -> i64 {
it.get("number").and_then(Value::as_i64).unwrap_or(0) it.get("number").and_then(Value::as_i64).unwrap_or(0)
} }
fn title(it: &Value) -> &str {
it.get("title").and_then(Value::as_str).unwrap_or("")
}
fn kind_label(it: &Value) -> &'static str {
if it.get("is_pr").and_then(Value::as_bool).unwrap_or(false) {
"pr"
} else {
"issue"
}
}
/// Either pretty-print the JSON array (when --json) or fall back to a
/// caller-supplied human one-liner per item.
fn emit<F>(client: &Client, items: &[Value], fmt: F) -> Result<()>
where
F: Fn(&Value) -> String,
{
if client.json_mode() {
print_json(&Value::Array(items.to_vec()))
} else {
if items.is_empty() {
println!("(no matches)");
}
for it in items {
println!("{}", fmt(it));
}
Ok(())
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@ -529,7 +559,10 @@ mod tests {
); );
let unset = issue(json!({ "labels": [{ "name": "area/ops" }] })); let unset = issue(json!({ "labels": [{ "name": "area/ops" }] }));
assert!(!has_scoped_label(&unset, "area/"), "absent means not exclusive"); assert!(
!has_scoped_label(&unset, "area/"),
"absent means not exclusive"
);
} }
/// The caller builds the prefix as `"<scope>/"`, which is what stops /// The caller builds the prefix as `"<scope>/"`, which is what stops
@ -567,7 +600,10 @@ mod tests {
// `deserialize_with`, so serde requires it to be present even though // `deserialize_with`, so serde requires it to be present even though
// its type is `Option`. The forge sends the key with a null value. // its type is `Option`. The forge sends the key with a null value.
let absent = pull(json!({ "requested_reviewers": null })); let absent = pull(json!({ "requested_reviewers": null }));
assert!(!has_requested_reviewer(&absent, None), "null is not a reviewer"); assert!(
!has_requested_reviewer(&absent, None),
"null is not a reviewer"
);
} }
#[test] #[test]
@ -641,7 +677,10 @@ mod tests {
State::Closed.issue_state(), State::Closed.issue_state(),
IssueListIssuesQueryState::Closed IssueListIssuesQueryState::Closed
)); ));
assert!(matches!(State::All.issue_state(), IssueListIssuesQueryState::All)); assert!(matches!(
State::All.issue_state(),
IssueListIssuesQueryState::All
));
assert!(matches!( assert!(matches!(
State::Open.pull_state(), State::Open.pull_state(),
RepoListPullRequestsQueryState::Open RepoListPullRequestsQueryState::Open
@ -656,34 +695,3 @@ mod tests {
)); ));
} }
} }
fn title(it: &Value) -> &str {
it.get("title").and_then(Value::as_str).unwrap_or("")
}
fn kind_label(it: &Value) -> &'static str {
if it.get("is_pr").and_then(Value::as_bool).unwrap_or(false) {
"pr"
} else {
"issue"
}
}
/// Either pretty-print the JSON array (when --json) or fall back to a
/// caller-supplied human one-liner per item.
fn emit<F>(client: &Client, items: &[Value], fmt: F) -> Result<()>
where
F: Fn(&Value) -> String,
{
if client.json_mode() {
print_json(&Value::Array(items.to_vec()))
} else {
if items.is_empty() {
println!("(no matches)");
}
for it in items {
println!("{}", fmt(it));
}
Ok(())
}
}