Skip to content

Commit 14c1a22

Browse files
bors[bot]Jasperav
andauthored
Merge #338
338: Remove Arc on api_key and host in Client structure r=bidoubiwa a=Jasperav It just removed an unnecessary `Arc` Co-authored-by: jaspervisser <[email protected]>
2 parents 8b824a9 + 6410730 commit 14c1a22

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/client.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ use crate::{
99
};
1010
use serde::Deserialize;
1111
use serde_json::{json, Value};
12-
use std::{collections::HashMap, sync::Arc, time::Duration};
12+
use std::{collections::HashMap, time::Duration};
1313
use time::OffsetDateTime;
1414

1515
/// The top-level struct of the SDK, representing a client containing [indexes](../indexes/struct.Index.html).
1616
#[derive(Debug, Clone)]
1717
pub struct Client {
18-
pub(crate) host: Arc<String>,
19-
pub(crate) api_key: Arc<String>,
18+
pub(crate) host: String,
19+
pub(crate) api_key: String,
2020
}
2121

2222
impl Client {
@@ -36,8 +36,8 @@ impl Client {
3636
/// ```
3737
pub fn new(host: impl Into<String>, api_key: impl Into<String>) -> Client {
3838
Client {
39-
host: Arc::new(host.into()),
40-
api_key: Arc::new(api_key.into()),
39+
host: host.into(),
40+
api_key: api_key.into(),
4141
}
4242
}
4343

@@ -985,7 +985,7 @@ mod tests {
985985
let key = client.create_key(key).await.unwrap();
986986
let master_key = client.api_key.clone();
987987
// this key has no right
988-
client.api_key = Arc::new(key.key.clone());
988+
client.api_key = key.key.clone();
989989
// with a wrong key
990990
let error = client.delete_key("invalid_key").await.unwrap_err();
991991
assert!(matches!(
@@ -1060,7 +1060,7 @@ mod tests {
10601060

10611061
// backup the master key for cleanup at the end of the test
10621062
let master_client = client.clone();
1063-
client.api_key = Arc::new(no_right_key.key.clone());
1063+
client.api_key = no_right_key.key.clone();
10641064

10651065
let mut key = KeyBuilder::new();
10661066
key.with_name(format!("{name}_2"));

0 commit comments

Comments
 (0)