Skip to content

Commit c9e4149

Browse files
committed
chore: new lint for to_string->clone
1 parent f004b1b commit c9e4149

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

src/core/ev_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ pub fn handle_event(
287287

288288
Command::SetPrompt(ref text) | Command::SendMessage(ref text) => {
289289
if let Command::SetPrompt(_) = ev {
290-
p.prompt = text.to_string();
290+
p.prompt = text.clone();
291291
} else {
292-
p.message = Some(text.to_string());
292+
p.message = Some(text.clone());
293293
}
294294
p.format_prompt();
295295
if !p.running.lock().is_uninitialized() {

src/input/definitions/keydefs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl KeySeq {
9999
}
100100
}
101101
Token::MultipleChar(c) => {
102-
let c = c.to_ascii_lowercase().to_string();
102+
let c = c.to_ascii_lowercase().clone();
103103
SPECIAL_KEYS.get(c.as_str()).map_or_else(
104104
|| panic!("'{}': Invalid key input sequence given", text),
105105
|key| {

src/input/definitions/mousedefs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn gen_mouse_event_from_tokenlist(token_list: &[Token], text: &str) -> MouseEven
6767
);
6868
}
6969
Token::MultipleChar(c) => {
70-
let c = c.to_ascii_lowercase().to_string();
70+
let c = c.to_ascii_lowercase().clone();
7171
MOUSE_ACTIONS.get(c.as_str()).map_or_else(
7272
|| panic!("'{}': Invalid key input sequence given", text),
7373
|k| {

src/search.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static WORD: LazyLock<Regex> = LazyLock::new(|| {
8383
Regex::new(r#"([\w_]+)|([-?~@#!$%^&*()-+={}\[\]:;\\|'/?<>.,"]+)|\W"#).unwrap()
8484
});
8585

86-
#[derive(Clone, Copy, Debug, Eq)]
86+
#[derive(Clone, Copy, Debug, Default, Eq)]
8787
#[cfg_attr(docsrs, doc(cfg(feature = "search")))]
8888
#[allow(clippy::module_name_repetitions)]
8989
/// Defines modes in which the search can run
@@ -93,15 +93,10 @@ pub enum SearchMode {
9393
/// Find matches before the current page
9494
Reverse,
9595
/// No search active
96+
#[default]
9697
Unknown,
9798
}
9899

99-
impl Default for SearchMode {
100-
fn default() -> Self {
101-
Self::Unknown
102-
}
103-
}
104-
105100
impl PartialEq for SearchMode {
106101
fn eq(&self, other: &Self) -> bool {
107102
core::mem::discriminant(self) == core::mem::discriminant(other)

0 commit comments

Comments
 (0)