mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 19:01:03 +00:00
Fixing a few clippy recommendations on 1.84 nightly.
This commit is contained in:
parent
b8dda06f5b
commit
09621d36bb
5 changed files with 26 additions and 17 deletions
|
@ -96,7 +96,7 @@ pub async fn get_conn<'a, 'b: 'a>(pool: &'a mut DbPool<'b>) -> Result<DbConn<'a>
|
|||
})
|
||||
}
|
||||
|
||||
impl<'a> Deref for DbConn<'a> {
|
||||
impl Deref for DbConn<'_> {
|
||||
type Target = AsyncPgConnection;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
@ -107,7 +107,7 @@ impl<'a> Deref for DbConn<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for DbConn<'a> {
|
||||
impl DerefMut for DbConn<'_> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
match self {
|
||||
DbConn::Pool(conn) => conn.deref_mut(),
|
||||
|
|
|
@ -50,9 +50,12 @@ use lemmy_db_schema::{
|
|||
ListingType,
|
||||
};
|
||||
|
||||
type QueriesReadTypes<'a> = (CommentId, Option<&'a LocalUser>);
|
||||
type QueriesListTypes<'a> = (CommentQuery<'a>, &'a Site);
|
||||
|
||||
fn queries<'a>() -> Queries<
|
||||
impl ReadFn<'a, CommentView, (CommentId, Option<&'a LocalUser>)>,
|
||||
impl ListFn<'a, CommentView, (CommentQuery<'a>, &'a Site)>,
|
||||
impl ReadFn<'a, CommentView, QueriesReadTypes<'a>>,
|
||||
impl ListFn<'a, CommentView, QueriesListTypes<'a>>,
|
||||
> {
|
||||
let creator_is_admin = exists(
|
||||
local_user::table.filter(
|
||||
|
@ -308,10 +311,10 @@ fn queries<'a>() -> Queries<
|
|||
}
|
||||
|
||||
impl CommentView {
|
||||
pub async fn read<'a>(
|
||||
pub async fn read(
|
||||
pool: &mut DbPool<'_>,
|
||||
comment_id: CommentId,
|
||||
my_local_user: Option<&'a LocalUser>,
|
||||
my_local_user: Option<&'_ LocalUser>,
|
||||
) -> Result<Self, Error> {
|
||||
// If a person is given, then my_vote (res.9), if None, should be 0, not null
|
||||
// Necessary to differentiate between other person's votes
|
||||
|
@ -345,7 +348,7 @@ pub struct CommentQuery<'a> {
|
|||
pub max_depth: Option<i32>,
|
||||
}
|
||||
|
||||
impl<'a> CommentQuery<'a> {
|
||||
impl CommentQuery<'_> {
|
||||
pub async fn list(self, site: &Site, pool: &mut DbPool<'_>) -> Result<Vec<CommentView>, Error> {
|
||||
Ok(
|
||||
queries()
|
||||
|
|
|
@ -62,9 +62,12 @@ use lemmy_db_schema::{
|
|||
use tracing::debug;
|
||||
use PostSortType::*;
|
||||
|
||||
type QueriesReadTypes<'a> = (PostId, Option<&'a LocalUser>, bool);
|
||||
type QueriesListTypes<'a> = (PostQuery<'a>, &'a Site);
|
||||
|
||||
fn queries<'a>() -> Queries<
|
||||
impl ReadFn<'a, PostView, (PostId, Option<&'a LocalUser>, bool)>,
|
||||
impl ListFn<'a, PostView, (PostQuery<'a>, &'a Site)>,
|
||||
impl ReadFn<'a, PostView, QueriesReadTypes<'a>>,
|
||||
impl ListFn<'a, PostView, QueriesListTypes<'a>>,
|
||||
> {
|
||||
let creator_is_admin = exists(
|
||||
local_user::table.filter(
|
||||
|
@ -431,10 +434,10 @@ fn queries<'a>() -> Queries<
|
|||
}
|
||||
|
||||
impl PostView {
|
||||
pub async fn read<'a>(
|
||||
pub async fn read(
|
||||
pool: &mut DbPool<'_>,
|
||||
post_id: PostId,
|
||||
my_local_user: Option<&'a LocalUser>,
|
||||
my_local_user: Option<&'_ LocalUser>,
|
||||
is_mod_or_admin: bool,
|
||||
) -> Result<Self, Error> {
|
||||
queries()
|
||||
|
|
|
@ -34,9 +34,12 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
type QueriesReadTypes<'a> = (CommunityId, Option<&'a LocalUser>, bool);
|
||||
type QueriesListTypes<'a> = (CommunityQuery<'a>, &'a Site);
|
||||
|
||||
fn queries<'a>() -> Queries<
|
||||
impl ReadFn<'a, CommunityView, (CommunityId, Option<&'a LocalUser>, bool)>,
|
||||
impl ListFn<'a, CommunityView, (CommunityQuery<'a>, &'a Site)>,
|
||||
impl ReadFn<'a, CommunityView, QueriesReadTypes<'a>>,
|
||||
impl ListFn<'a, CommunityView, QueriesListTypes<'a>>,
|
||||
> {
|
||||
let all_joins = |query: community::BoxedQuery<'a, Pg>, my_local_user: Option<&'a LocalUser>| {
|
||||
query
|
||||
|
@ -166,10 +169,10 @@ fn queries<'a>() -> Queries<
|
|||
}
|
||||
|
||||
impl CommunityView {
|
||||
pub async fn read<'a>(
|
||||
pub async fn read(
|
||||
pool: &mut DbPool<'_>,
|
||||
community_id: CommunityId,
|
||||
my_local_user: Option<&'a LocalUser>,
|
||||
my_local_user: Option<&'_ LocalUser>,
|
||||
is_mod_or_admin: bool,
|
||||
) -> Result<Self, Error> {
|
||||
queries()
|
||||
|
@ -253,7 +256,7 @@ pub struct CommunityQuery<'a> {
|
|||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
impl<'a> CommunityQuery<'a> {
|
||||
impl CommunityQuery<'_> {
|
||||
pub async fn list(self, site: &Site, pool: &mut DbPool<'_>) -> Result<Vec<CommunityView>, Error> {
|
||||
queries().list(pool, (self, site)).await
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ pub(crate) struct SendRetryTask<'a> {
|
|||
pub stop: CancellationToken,
|
||||
}
|
||||
|
||||
impl<'a> SendRetryTask<'a> {
|
||||
impl SendRetryTask<'_> {
|
||||
// this function will return successfully when (a) send succeeded or (b) worker cancelled
|
||||
// and will return an error if an internal error occurred (send errors cause an infinite loop)
|
||||
pub async fn send_retry_loop(self) -> Result<()> {
|
||||
|
|
Loading…
Reference in a new issue