Skip to content

Commit

Permalink
chore: Fix (some) warnings in UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker committed Oct 14, 2024
1 parent a0017de commit 23726fe
Show file tree
Hide file tree
Showing 33 changed files with 183 additions and 296 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pavex::blueprint::{constructor::CloningStrategy, router::GET, Blueprint};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@
│ You can do so by invoking `.cloning(CloningStrategy::CloneIfNecessary)`
│ on the type returned by `.constructor`.
│ ☞
│ ╭─[borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/src/lib.rs:65:1]
│ 65 │ .error_handler(f!(crate::error_handler));
│ 66 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
│ ·  ──────┬─────
│ · ╰── The constructor was registered here
│ 67 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
│ ╭─[borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/src/lib.rs:59:1]
│ 59 │ .error_handler(f!(crate::error_handler));
│ 60 │ bp.request_scoped(f!(crate::b));
│ ·  ──────┬─────
│ · ╰── The constructor was registered here
│ 61 │ bp.request_scoped(f!(crate::c));
│ ╰────
│ help: Considering changing the signature of the components that consume
│ `app::B` by value.
│ Would a shared reference, `&app::B`, be enough?
│ ☞
│ ╭─[borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/src/lib.rs:67:1]
│ 67 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
│ 68 │ bp.route(GET, "/home", f!(crate::handler));
│ ╭─[borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/src/lib.rs:61:1]
│ 61 │ bp.request_scoped(f!(crate::c));
│ 62 │ bp.route(GET, "/home", f!(crate::handler));
│ ·  ─────────┬────────
│ · One of the consuming request handlers
│ 69 │ bp
│ 63 │ bp
│ ╰────
│ ☞
│ ╭─[borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/src/lib.rs:66:1]
│ 66 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
│ 67 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
│ ·  ──────┬─────
│ · ╰── One of the consuming constructors
│ 68 │ bp.route(GET, "/home", f!(crate::handler));
│ ╭─[borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/src/lib.rs:60:1]
│ 60 │ bp.request_scoped(f!(crate::b));
│ 61 │ bp.request_scoped(f!(crate::c));
│ ·  ──────┬─────
│ · ╰── One of the consuming constructors
│ 62 │ bp.route(GET, "/home", f!(crate::handler));
│ ╰────
│ help: If `app::B` itself cannot implement `Clone`, consider
│ wrapping it in an `std::sync::Rc` or `std::sync::Arc`.
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
use std::path::PathBuf;

use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::response::Response;

// The call graph looks like this:
Expand Down Expand Up @@ -61,10 +55,10 @@ pub fn handler(_b: B, _c: C) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped)
bp.request_scoped(f!(crate::a))
.error_handler(f!(crate::error_handler));
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
use std::path::PathBuf;

use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::response::Response;

// The call graph looks like this:
Expand Down Expand Up @@ -48,9 +42,9 @@ pub fn handler(_a: A, _b: B) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped)
bp.request_scoped(f!(crate::a))
.error_handler(f!(crate::error_handler));
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::b));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down Expand Up @@ -56,12 +50,10 @@ pub fn handler(_c: C, _d: D) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped)
.clone_if_necessary();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped)
.clone_if_necessary();
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.constructor(f!(crate::d), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::a)).clone_if_necessary();
bp.request_scoped(f!(crate::b)).clone_if_necessary();
bp.request_scoped(f!(crate::c));
bp.request_scoped(f!(crate::d));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down Expand Up @@ -56,12 +50,10 @@ pub fn handler(_c: C, _d: D) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped)
.clone_if_necessary();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped)
.clone_if_necessary();
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.constructor(f!(crate::d), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::a)).clone_if_necessary();
bp.request_scoped(f!(crate::b)).clone_if_necessary();
bp.request_scoped(f!(crate::c));
bp.request_scoped(f!(crate::d));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
│ You can do so by invoking `.cloning(CloningStrategy::CloneIfNecessary)`
│ on the type returned by `.constructor`.
│ ☞
│ ╭─[borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/src/lib.rs:51:1]
│ 51 │ let mut bp = Blueprint::new();
│ 52 │ bp.constructor(f!(crate::a), Lifecycle::RequestScoped);
│ ·  ──────┬─────
│ · ╰── The constructor was registered here
│ 53 │ // Being a singleton, this will be an input type of the dependency closure for the request handler
│ ╭─[borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/src/lib.rs:49:1]
│ 49 │ let mut bp = Blueprint::new();
│ 50 │ bp.request_scoped(f!(crate::a));
│ ·  ──────┬─────
│ · ╰── The constructor was registered here
│ 51 │ // Being a singleton, this will be an input type of the dependency closure for the request handler
│ ╰────
│ help: Considering changing the signature of `app::a`.
│ It takes `app::A` by value. Would a shared reference,
Expand All @@ -35,12 +35,12 @@
│ You can do so by invoking `.cloning(CloningStrategy::CloneIfNecessary)`
│ on the type returned by `.constructor`.
│ ☞
│ ╭─[borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/src/lib.rs:53:1]
│ 53 │ // Being a singleton, this will be an input type of the dependency closure for the request handler
│ 54 │ bp.constructor(f!(crate::b), Lifecycle::Singleton);
│ ·  ──────┬─────
│ · ╰── The constructor was registered here
│ 55 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
│ ╭─[borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/src/lib.rs:51:1]
│ 51 │ // Being a singleton, this will be an input type of the dependency closure for the request handler
│ 52 │ bp.singleton(f!(crate::b));
│ ·  ──────┬─────
│ · ╰── The constructor was registered here
│ 53 │ bp.request_scoped(f!(crate::c));
│ ╰────
│ help: Considering changing the signature of `app::b`.
│ It takes `app::B` by value. Would a shared reference,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{constructor::Lifecycle, router::GET, Blueprint};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down Expand Up @@ -49,11 +47,11 @@ pub fn handler(_c: C, _d: D) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::a));
// Being a singleton, this will be an input type of the dependency closure for the request handler
bp.constructor(f!(crate::b), Lifecycle::Singleton);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.constructor(f!(crate::d), Lifecycle::RequestScoped);
bp.singleton(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.request_scoped(f!(crate::d));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::request::path::RawPathParams;
use pavex::response::Response;
Expand Down Expand Up @@ -39,8 +33,8 @@ pub fn handler(_b: B, _c: C) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down Expand Up @@ -45,10 +39,9 @@ pub fn handler(_b: B, _c: C) -> Response {
pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
// A is a singleton, so it will be an input parameter of the dependency closure for `handler`
bp.constructor(f!(crate::a), Lifecycle::Singleton)
.clone_if_necessary();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.singleton(f!(crate::a)).clone_if_necessary();
bp.request_scoped(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down Expand Up @@ -44,10 +38,9 @@ pub fn handler(_b: B, _c: C) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped)
.clone_if_necessary();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::a)).clone_if_necessary();
bp.request_scoped(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::path::PathBuf;

use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::response::Response;

Expand Down Expand Up @@ -44,10 +38,9 @@ pub fn handler(_b: B, _c: C) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::a), Lifecycle::RequestScoped)
.clone_if_necessary();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::a)).clone_if_necessary();
bp.request_scoped(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
│ `pavex::request::RequestHead` by value.
│ Would a shared reference, `&pavex::request::RequestHead`, be enough?
│ ☞
│ ╭─[borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/src/lib.rs:39:1]
│ 39 │ let mut bp = Blueprint::new();
│ 40 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
│ ·  ──────┬─────
│ · ╰── One of the consuming constructors
│ 41 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
│ ╭─[borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/src/lib.rs:35:1]
│ 35 │ let mut bp = Blueprint::new();
│ 36 │ bp.request_scoped(f!(crate::b));
│ ·  ──────┬─────
│ · ╰── One of the consuming constructors
│ 37 │ bp.request_scoped(f!(crate::c));
│ ╰────
│ ☞
│ ╭─[borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/src/lib.rs:40:1]
│ 40 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
│ 41 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
│ ·  ──────┬─────
│ · ╰── One of the consuming constructors
│ 42 │ bp.route(GET, "/home", f!(crate::handler));
│ ╭─[borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/src/lib.rs:36:1]
│ 36 │ bp.request_scoped(f!(crate::b));
│ 37 │ bp.request_scoped(f!(crate::c));
│ ·  ──────┬─────
│ · ╰── One of the consuming constructors
│ 38 │ bp.route(GET, "/home", f!(crate::handler));
│ ╰────
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use pavex::blueprint::{
constructor::{CloningStrategy, Lifecycle},
router::GET,
Blueprint,
};
use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;
use pavex::request::RequestHead;
use pavex::response::Response;
Expand Down Expand Up @@ -37,8 +33,8 @@ pub fn handler(_b: B, _c: C) -> Response {

pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.constructor(f!(crate::b), Lifecycle::RequestScoped);
bp.constructor(f!(crate::c), Lifecycle::RequestScoped);
bp.request_scoped(f!(crate::b));
bp.request_scoped(f!(crate::c));
bp.route(GET, "/home", f!(crate::handler));
bp
}
Loading

0 comments on commit 23726fe

Please sign in to comment.