Skip to content

Commit

Permalink
remove redundant lifetime bound (#1148)
Browse files Browse the repository at this point in the history
* remove redundant lifetime bound

* clippy fix
  • Loading branch information
fakeshadow authored Oct 6, 2024
1 parent 033e2f9 commit 8cc0757
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions postgres/src/execute/async_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ where

impl<'c, C> Execute<&'c C> for StatementNamed<'_>
where
C: Prepare + 'c,
C: Prepare,
{
type ExecuteOutput = ResultFuture<IntoGuardedFuture<'c, C>>;
type QueryOutput = Self::ExecuteOutput;
Expand Down Expand Up @@ -117,7 +117,7 @@ where

impl<'c, C, P> Execute<&'c C> for StatementUnnamedBind<'_, P>
where
C: Prepare + 'c,
C: Prepare,
P: AsParams,
{
type ExecuteOutput = ResultFuture<RowAffected>;
Expand All @@ -138,7 +138,7 @@ where

impl<'c, C> Execute<&'c C> for &std::path::Path
where
C: Query + Sync + 'c,
C: Query + Sync,
{
type ExecuteOutput = BoxedFuture<'c, Result<u64, Error>>;
type QueryOutput = BoxedFuture<'c, Result<RowSimpleStream, Error>>;
Expand Down
4 changes: 2 additions & 2 deletions postgres/src/execute/sync_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where

impl<'c, C> ExecuteBlocking<&'c C> for StatementNamed<'_>
where
C: Prepare + 'c,
C: Prepare,
{
type ExecuteOutput = Result<StatementGuarded<'c, C>, Error>;
type QueryOutput = Self::ExecuteOutput;
Expand Down Expand Up @@ -90,7 +90,7 @@ where

impl<'c, C, P> ExecuteBlocking<&'c C> for StatementUnnamedBind<'_, P>
where
C: Prepare + 'c,
C: Prepare,
P: AsParams,
{
type ExecuteOutput = Result<u64, Error>;
Expand Down
3 changes: 2 additions & 1 deletion postgres/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Pool {

/// try to get a connection from pool.
/// when pool is empty it will try to spawn new connection to database and if the process failed the outcome will
/// return as [Error]
/// return as [`Error`]
pub async fn get(&self) -> Result<PoolConnection<'_>, Error> {
let _permit = self.permits.acquire().await.expect("Semaphore must not be closed");
let conn = match self.conn.lock().unwrap().pop_front() {
Expand All @@ -94,6 +94,7 @@ impl Pool {
})
}

#[cold]
#[inline(never)]
fn connect(&self) -> BoxedFuture<'_, Result<PoolClient, Error>> {
Box::pin(async move {
Expand Down
6 changes: 3 additions & 3 deletions web/src/handler/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ use xitca_service::{fn_build, FnService, Service};
/// ```
///
/// [handler_service]: super::handler_service
pub fn handler_sync_service<Arg, F, T, O>(
func: F,
) -> FnService<impl Fn(Arg) -> Ready<Result<HandlerServiceSync<F, T, O>, Infallible>>>
pub fn handler_sync_service<Arg, F, T, O>(func: F) -> FnService<impl Fn(Arg) -> Ready<FnServiceOutput<F, T, O>>>
where
F: Closure<T> + Send + Clone,
{
Expand All @@ -52,6 +50,8 @@ where
})
}

type FnServiceOutput<F, T, O> = Result<HandlerServiceSync<F, T, O>, Infallible>;

pub struct HandlerServiceSync<F, T, O> {
func: F,
_p: PhantomData<(T, O)>,
Expand Down

0 comments on commit 8cc0757

Please sign in to comment.