Skip to content

Commit

Permalink
fix: remove useless ArcStrs
Browse files Browse the repository at this point in the history
  • Loading branch information
cailloumajor committed Sep 28, 2023
1 parent b6803c6 commit e99286a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2021"

[dependencies]
anyhow = "1.0.75"
arcstr = { version = "1.1.5", default-features = false }
clap-verbosity-flag = "2.0.1"
futures-util = "0.3.28"
mongodb = "2.6.1"
Expand Down
11 changes: 5 additions & 6 deletions src/db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::time::Duration;

use anyhow::Context;
use arcstr::ArcStr;
use clap::Args;
use futures_util::TryFutureExt;
use mongodb::bson::{doc, Bson, Document};
Expand All @@ -26,8 +25,8 @@ pub(crate) struct Config {

#[derive(Debug)]
pub(crate) struct GetConfigRequest {
pub(crate) collection: ArcStr,
pub(crate) id: ArcStr,
pub(crate) collection: String,
pub(crate) id: String,
}

#[derive(Debug)]
Expand Down Expand Up @@ -93,15 +92,15 @@ impl Database {
while let Some((request, response_tx)) = rx.recv().await {
debug!(msg = "request received", ?request);
let collection = cloned_self.0.collection::<Document>(&request.collection);
let mut document_id = request.id.clone();
let filter = doc! { "_id": request.id.as_str() };
let mut document_id = request.id;
let filter = doc! { "_id": &document_id };
let found = collection
.find_one(filter, None)
.and_then(|first_found| async {
if let Some(Bson::ObjectId(links_id)) =
first_found.as_ref().and_then(|doc| doc.get("_links"))
{
document_id = ArcStr::from(links_id.to_string());
document_id = links_id.to_string();
let filter = doc! { "_id": links_id };
collection.find_one(filter, None).await
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/http_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ async fn get_config_handler(
State(state): State<AppState>,
Path((collection, id)): Path<(String, String)>,
) -> Result<GetConfigResponse, impl IntoResponse> {
let collection = collection.into();
let id = id.into();
let request = GetConfigRequest { collection, id };
let (tx, rx) = oneshot::channel();
state
Expand Down

0 comments on commit e99286a

Please sign in to comment.