Switch from .to_string() to .to_owned()

This commit is contained in:
Neshura 2023-12-29 14:34:33 +01:00
parent 3ecd434580
commit 654bc5c7f8
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
6 changed files with 13 additions and 13 deletions

View file

@ -70,7 +70,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
Ok(data) => data,
Err(e) => panic!("{}", e),
};
let message = Message::Info("Config reloaded".to_string());
let message = Message::Info("Config reloaded".to_owned());
if !write.messages.contains(&message) {
write.messages.push(message);
};
@ -106,7 +106,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
continue
}
};
let message = Message::Info("Communities reloaded".to_string());
let message = Message::Info("Communities reloaded".to_owned());
if !read.messages.contains(&message) {
drop(read);
let mut write = data.write().await;

View file

@ -32,7 +32,7 @@ impl Config {
impl Default for Config {
fn default() -> Self {
Config {
instance: "".to_string(),
instance: "".to_owned(),
status_post_url: None,
config_reload_seconds: 21600,
protected_communities: vec![],

View file

@ -12,13 +12,13 @@ static PAST_DAYS_ELIGIBLE: u8 = 4;
macro_rules! api_url {
() => {
"https://labs.j-novel.club/app/v1".to_string()
"https://labs.j-novel.club/app/v1".to_owned()
};
}
macro_rules! jnc_base_url {
() => {
"https://j-novel.club".to_string()
"https://j-novel.club".to_owned()
};
}

View file

@ -48,7 +48,7 @@ pub(crate) async fn login(credentials: &Credentials, instance: &str) -> Result<L
};
let response = match HTTP_CLIENT
.post(instance.to_string() + "/api/v3/user/login")
.post(instance.to_owned() + "/api/v3/user/login")
.json(&login_params)
.send()
.await {
@ -62,7 +62,7 @@ pub(crate) async fn login(credentials: &Credentials, instance: &str) -> Result<L
match data.jwt {
Some(token) => Ok(Lemmy {
jwt_token: token.clone(),
instance: instance.to_string(),
instance: instance.to_owned(),
}),
None => panic!("Login did not return JWT token. Are the credentials valid?")
}

View file

@ -39,7 +39,7 @@ impl SharedData {
SharedData {
messages: vec![],
config: Config {
instance: "".to_string(),
instance: "".to_owned(),
status_post_url: None,
config_reload_seconds: 0,
protected_communities: vec![],
@ -98,7 +98,7 @@ async fn main() {
tui_thread.abort();
data = persistent_data.read().await.clone();
data.messages.push(Message::Error("Bot crashed due to unknown Error, restarting thread after wait...".to_string()));
data.messages.push(Message::Error("Bot crashed due to unknown Error, restarting thread after wait...".to_owned()));
sleep(Duration::seconds(5).to_std().expect("Conversion should always work since static")).await;
}
}

View file

@ -71,7 +71,7 @@ impl SeriesHistory {
}
pub(crate) fn set_series(&mut self, series: &str, data: PostHistory) {
self.series.entry(series.to_string()).and_modify(|val| {
self.series.entry(series.to_owned()).and_modify(|val| {
*val = data.clone()
})
.or_insert(data);
@ -88,14 +88,14 @@ impl PostHistory {
match self.parts.get(part) {
Some(history) => history.clone(),
None => PostHistoryInner {
volume: "".to_string(),
chapter: "".to_string(),
volume: "".to_owned(),
chapter: "".to_owned(),
}
}
}
pub(crate) fn set_part(&mut self, part: &str, data: PostHistoryInner) {
self.parts.entry(part.to_string()).and_modify(|val| {
self.parts.entry(part.to_owned()).and_modify(|val| {
*val = data.clone()
})
.or_insert(data);