We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88d10ee commit c70d67dCopy full SHA for c70d67d
src/modules/insert.rs
@@ -74,7 +74,7 @@ impl Module for Insert {
74
}
75
else {
76
self.line_type = action.clone();
77
- self.edit.set_label(format!("{} ", action.to_string()).as_str());
+ self.edit.set_label(format!("{action} ").as_str());
78
self.state = InsertState::Edit;
79
80
src/modules/insert/line_type.rs
@@ -1,3 +1,5 @@
1
+use std::fmt::Display;
2
+
3
#[derive(Clone, Debug, PartialEq, Eq)]
4
pub(crate) enum LineType {
5
Cancel,
@@ -9,16 +11,16 @@ pub(crate) enum LineType {
9
11
UpdateRef,
10
12
13
-impl ToString for LineType {
- fn to_string(&self) -> String {
14
+impl Display for LineType {
15
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16
match *self {
- Self::Cancel => String::from("<cancel>"),
- Self::Pick => String::from("pick"),
17
- Self::Exec => String::from("exec"),
18
- Self::Label => String::from("label"),
19
- Self::Merge => String::from("merge"),
20
- Self::Reset => String::from("reset"),
21
- Self::UpdateRef => String::from("update-ref"),
+ Self::Cancel => write!(f, "<cancel>"),
+ Self::Pick => write!(f, "pick"),
+ Self::Exec => write!(f, "exec"),
+ Self::Label => write!(f, "label"),
+ Self::Merge => write!(f, "merge"),
22
+ Self::Reset => write!(f, "reset"),
23
+ Self::UpdateRef => write!(f, "update-ref"),
24
25
26
0 commit comments