Remove unnecessary as_str() conversions
This commit is contained in:
parent
9de45d0443
commit
11ed4c1e48
3 changed files with 7 additions and 7 deletions
|
@ -21,13 +21,13 @@ pub async fn create_test_database() -> Client {
|
|||
"DROP DATABASE IF EXISTS {db_name:?}",
|
||||
db_name=db_name,
|
||||
);
|
||||
db_client.execute(drop_db_statement.as_str(), &[]).await.unwrap();
|
||||
db_client.execute(&drop_db_statement, &[]).await.unwrap();
|
||||
let create_db_statement = format!(
|
||||
"CREATE DATABASE {db_name:?} WITH OWNER={owner:?};",
|
||||
db_name=db_name,
|
||||
owner=db_config.get_user().unwrap(),
|
||||
);
|
||||
db_client.execute(create_db_statement.as_str(), &[]).await.unwrap();
|
||||
db_client.execute(&create_db_statement, &[]).await.unwrap();
|
||||
|
||||
// Create new connection to database
|
||||
db_config.dbname(&db_name);
|
||||
|
|
|
@ -160,7 +160,7 @@ pub async fn get_notifications(
|
|||
related_links=RELATED_LINKS,
|
||||
);
|
||||
let rows = db_client.query(
|
||||
statement.as_str(),
|
||||
&statement,
|
||||
&[&recipient_id, &max_id, &i64::from(limit)],
|
||||
).await?;
|
||||
let mut notifications: Vec<Notification> = rows.iter()
|
||||
|
|
|
@ -68,7 +68,7 @@ pub async fn create_post(
|
|||
visibility_public=i16::from(&Visibility::Public),
|
||||
);
|
||||
let maybe_post_row = transaction.query_opt(
|
||||
insert_statement.as_str(),
|
||||
&insert_statement,
|
||||
&[
|
||||
&post_id,
|
||||
&author_id,
|
||||
|
@ -586,7 +586,7 @@ pub async fn get_post_by_id(
|
|||
related_links=RELATED_LINKS,
|
||||
);
|
||||
let maybe_row = db_client.query_opt(
|
||||
statement.as_str(),
|
||||
&statement,
|
||||
&[&post_id],
|
||||
).await?;
|
||||
let post = match maybe_row {
|
||||
|
@ -678,7 +678,7 @@ pub async fn get_post_by_remote_object_id(
|
|||
related_links=RELATED_LINKS,
|
||||
);
|
||||
let maybe_row = db_client.query_opt(
|
||||
statement.as_str(),
|
||||
&statement,
|
||||
&[&object_id],
|
||||
).await?;
|
||||
let row = maybe_row.ok_or(DatabaseError::NotFound("post"))?;
|
||||
|
@ -708,7 +708,7 @@ pub async fn get_post_by_ipfs_cid(
|
|||
related_links=RELATED_LINKS,
|
||||
);
|
||||
let result = db_client.query_opt(
|
||||
statement.as_str(),
|
||||
&statement,
|
||||
&[&ipfs_cid],
|
||||
).await?;
|
||||
let post = match result {
|
||||
|
|
Loading…
Reference in a new issue