fix: clippy 1.96 lints — map_or, duplicate_mod, needless_borrows, slice_refs
Some checks failed
CI / Check / Test (push) Failing after 44s
Some checks failed
CI / Check / Test (push) Failing after 44s
This commit is contained in:
@@ -95,7 +95,7 @@ async fn get_by_id_returns_person() {
|
|||||||
let adapter = SqlitePersonAdapter::new(pool.clone());
|
let adapter = SqlitePersonAdapter::new(pool.clone());
|
||||||
|
|
||||||
let p = make_person(42, "Charlie", Some("Acting"));
|
let p = make_person(42, "Charlie", Some("Acting"));
|
||||||
adapter.upsert_batch(&[p.clone()]).await.unwrap();
|
adapter.upsert_batch(std::slice::from_ref(&p)).await.unwrap();
|
||||||
|
|
||||||
let found = adapter.get_by_id(p.id()).await.unwrap().unwrap();
|
let found = adapter.get_by_id(p.id()).await.unwrap().unwrap();
|
||||||
assert_eq!(found.name(), "Charlie");
|
assert_eq!(found.name(), "Charlie");
|
||||||
@@ -117,7 +117,7 @@ async fn get_credits_returns_cast_and_crew() {
|
|||||||
let adapter = SqlitePersonAdapter::new(pool.clone());
|
let adapter = SqlitePersonAdapter::new(pool.clone());
|
||||||
|
|
||||||
let p = make_person(7, "Diana", Some("Acting"));
|
let p = make_person(7, "Diana", Some("Acting"));
|
||||||
adapter.upsert_batch(&[p.clone()]).await.unwrap();
|
adapter.upsert_batch(std::slice::from_ref(&p)).await.unwrap();
|
||||||
|
|
||||||
sqlx::query("INSERT INTO movies VALUES ('m1', 'The Film', 2020, 'Dir', NULL, NULL)")
|
sqlx::query("INSERT INTO movies VALUES ('m1', 'The Film', 2020, 'Dir', NULL, NULL)")
|
||||||
.execute(&pool)
|
.execute(&pool)
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ pub struct TestContextBuilder {
|
|||||||
pub config: AppConfig,
|
pub config: AppConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for TestContextBuilder {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TestContextBuilder {
|
impl TestContextBuilder {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -156,4 +156,4 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[path = "tests/extractors.rs"]
|
#[path = "tests/extractors.rs"]
|
||||||
mod tests;
|
pub(crate) mod tests;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use super::extractors::{Panic, make_test_state};
|
use crate::extractors::tests::{Panic, make_test_state};
|
||||||
use axum::{
|
use axum::{
|
||||||
Router,
|
Router,
|
||||||
body::Body,
|
body::Body,
|
||||||
@@ -133,7 +133,7 @@ async fn person_endpoint_returns_404_for_unknown_id() {
|
|||||||
let resp = app
|
let resp = app
|
||||||
.oneshot(
|
.oneshot(
|
||||||
Request::builder()
|
Request::builder()
|
||||||
.uri(&format!("/api/v1/people/{}", unknown_id))
|
.uri(format!("/api/v1/people/{}", unknown_id))
|
||||||
.body(Body::empty())
|
.body(Body::empty())
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
@@ -159,7 +159,7 @@ async fn person_credits_endpoint_returns_404_for_unknown_id() {
|
|||||||
let resp = app
|
let resp = app
|
||||||
.oneshot(
|
.oneshot(
|
||||||
Request::builder()
|
Request::builder()
|
||||||
.uri(&format!("/api/v1/people/{}/credits", unknown_id))
|
.uri(format!("/api/v1/people/{}/credits", unknown_id))
|
||||||
.body(Body::empty())
|
.body(Body::empty())
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1 @@
|
|||||||
// API types for tests
|
|
||||||
pub use crate::{
|
|
||||||
extractors::{AuthenticatedUser, OptionalCookieUser, RequiredCookieUser},
|
|
||||||
forms::{LogReviewData, LogReviewForm, to_diary_query},
|
|
||||||
};
|
|
||||||
pub use api_types::{DiaryQueryParams, LogReviewRequest};
|
|
||||||
|
|
||||||
mod api_handlers;
|
mod api_handlers;
|
||||||
mod extractors;
|
|
||||||
mod forms;
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ fn login_submit_with_empty_fields_sets_error_status() {
|
|||||||
let mut app = login_app();
|
let mut app = login_app();
|
||||||
let cmds = update(&mut app, Action::LoginSubmit);
|
let cmds = update(&mut app, Action::LoginSubmit);
|
||||||
assert!(cmds.is_empty());
|
assert!(cmds.is_empty());
|
||||||
assert!(app.status.as_ref().map_or(false, |s| s.is_error));
|
assert!(app.status.as_ref().is_some_and(|s| s.is_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -170,7 +170,7 @@ fn auth_fail_sets_error_status_and_clears_loading() {
|
|||||||
app.loading = true;
|
app.loading = true;
|
||||||
update(&mut app, Action::AuthFail("bad creds".into()));
|
update(&mut app, Action::AuthFail("bad creds".into()));
|
||||||
assert!(!app.loading);
|
assert!(!app.loading);
|
||||||
assert!(app.status.as_ref().map_or(false, |s| s.is_error));
|
assert!(app.status.as_ref().is_some_and(|s| s.is_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Diary ─────────────────────────────────────────────────────────────────
|
// ── Diary ─────────────────────────────────────────────────────────────────
|
||||||
@@ -360,7 +360,7 @@ fn review_submit_with_missing_title_and_id_sets_error() {
|
|||||||
}
|
}
|
||||||
let cmds = update(&mut app, Action::ReviewSubmit);
|
let cmds = update(&mut app, Action::ReviewSubmit);
|
||||||
assert!(cmds.is_empty());
|
assert!(cmds.is_empty());
|
||||||
assert!(app.status.as_ref().map_or(false, |s| s.is_error));
|
assert!(app.status.as_ref().is_some_and(|s| s.is_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Bulk Import ───────────────────────────────────────────────────────────
|
// ── Bulk Import ───────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user