Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1db91b6

Browse files
committed
replace ToString with Display
1 parent2f3be66 commit1db91b6

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

‎src/dialog.rs‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ pub enum ButtonClass {
2626
Info,
2727
}
2828

29-
implToStringforButtonClass{
30-
fnto_string(&self) ->String{
29+
implstd::fmt::DisplayforButtonClass{
30+
fnfmt(&self,f:&mut std::fmt::Formatter<'_>) ->std::fmt::Result{
3131
matchself{
32-
Self::Primary =>"Primary",
33-
Self::Secondary =>"Secondary",
34-
Self::Success =>"Success",
35-
Self::Warning =>"Warning",
36-
Self::Info =>"Info",
32+
Self::Primary =>write!(f,"Primary"),
33+
Self::Secondary =>write!(f,"Secondary"),
34+
Self::Success =>write!(f,"Success"),
35+
Self::Warning =>write!(f,"Warning"),
36+
Self::Info =>write!(f,"Info"),
3737
}
38-
.to_string()
3938
}
4039
}
4140

‎src/icon.rs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,17 @@ fn svg(name: &str) -> String {
168168
format!("{}/{}.svg#icon", icon_folder(), name.to_lowercase())
169169
}
170170

171-
implToStringforIcon{
172-
fnto_string(&self) ->String{
171+
implstd::fmt::DisplayforIcon{
172+
fnfmt(&self,f:&mut std::fmt::Formatter<'_>) ->std::fmt::Result{
173173
matchself{
174-
Icon::Url(url) =>url.clone(),
175-
Icon::IconRootCustom(name) =>custom(name),
176-
Icon::IconRootSVG(name) =>svg(name),
177-
Icon::Css(name) =>name.clone(),
174+
Icon::Url(url) =>write!(f,"{}", url),
175+
Icon::IconRootCustom(name) =>write!(f,"{}",custom(name)),
176+
Icon::IconRootSVG(name) =>write!(f,"{}",svg(name)),
177+
Icon::Css(name) =>write!(f,"{}", name),
178178
}
179179
}
180180
}
181+
181182
implFrom<Icon>forString{
182183
fnfrom(icon:Icon) ->Self{
183184
icon.to_string()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp