Skip to content

Commit

Permalink
Fix assigning_clones lints
Browse files Browse the repository at this point in the history
`clone_from` can be more efficient than cloning then assigning.
  • Loading branch information
osa1 committed May 3, 2024
1 parent 6993ce5 commit ee8615a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/libtiny_client/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ impl StateInner {

fn reset(&mut self) {
self.nick_accepted = false;
self.nicks = self.server_info.nicks.clone();
self.nicks.clone_from(&self.server_info.nicks);
self.current_nick_idx = 0;
self.current_nick = self.nicks[0].clone();
self.current_nick.clone_from(&self.nicks[0]);
// Only reset the values here; the key set will be used to join channels
for chan in &mut self.chans {
chan.reset();
Expand Down Expand Up @@ -270,7 +270,8 @@ impl StateInner {
}
self.current_nick = new_nick;
} else {
self.current_nick = self.nicks[self.current_nick_idx].clone();
self.current_nick
.clone_from(&self.nicks[self.current_nick_idx]);
}
&self.current_nick
}
Expand Down Expand Up @@ -564,7 +565,7 @@ impl StateInner {
}
}

self.current_nick = new_nick.to_owned();
self.current_nick.clone_from(new_nick);

if let Some(ref pwd) = self.nickserv_ident {
snd_irc_msg
Expand Down

0 comments on commit ee8615a

Please sign in to comment.