chore: fix certain uninlined string format uses (#1310)

* Fixed uninlined args

First ran this, and fixed a few more similar issues by hand

```
cargo clippy --workspace --fix --benches --tests --bins -- -A clippy::all -W clippy::uninlined_format_args
```

Note that in a few cases, format args were passed by ref - which is actually a tiny perf hit - compiler would not be able to optimize them.

* revert change here

since it contains a non-inlineable variable I'm not a fan of using it partially here

* revert

given the other formats above/below I would prefer keeping it like this

---------

Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
This commit is contained in:
Yuri AstrakhanandClement Tsang authored and GitHub committed 2023-11-15 03:47:22 -05:00
1 parent a6200640b9
commit 5eb4fbde5d
18 files changed
+46 -58

No files matched your search

+2 -2
View File
@@ -69,7 +69,7 @@ impl DiskWidgetData {
pub fn free_percent_string(&self) -> KString {
match self.free_percent() {
Some(val) => format!("{:.1}%", val).into(),
Some(val) => format!("{val:.1}%").into(),
None => "N/A".into(),
}
}
@@ -90,7 +90,7 @@ impl DiskWidgetData {
pub fn used_percent_string(&self) -> KString {
match self.used_percent() {
Some(val) => format!("{:.1}%", val).into(),
Some(val) => format!("{val:.1}%").into(),
None => "N/A".into(),
}
}
@@ -101,7 +101,7 @@ impl PartialOrd for MemUsage {
impl Display for MemUsage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
MemUsage::Percent(percent) => f.write_fmt(format_args!("{:.1}%", percent)),
MemUsage::Percent(percent) => f.write_fmt(format_args!("{percent:.1}%")),
MemUsage::Bytes(bytes) => f.write_str(&binary_byte_string(*bytes)),
}
}