Skip to content

Commit 1749515

Browse files
committed
clippy: variables can be used directly in the format! string
1 parent c8b2fb2 commit 1749515

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/blocks/calendar/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl OAuth2Flow {
190190
) -> Result<OAuth2TokenResponse, CalendarError> {
191191
let client = self.client.clone();
192192
let redirect_port = self.redirect_port;
193-
let listener = TcpListener::bind(format!("127.0.0.1:{}", redirect_port)).await?;
193+
let listener = TcpListener::bind(format!("127.0.0.1:{redirect_port}")).await?;
194194
let (mut stream, _) = listener.accept().await?;
195195
let mut request_line = String::new();
196196
let mut reader = BufReader::new(&mut stream);

src/blocks/privacy.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl std::fmt::Display for PrivacyInfoInner {
141141
.map(|(destination, count)| if count == &1 {
142142
destination.into()
143143
} else {
144-
format!("{} (x{})", destination, count)
144+
format!("{destination} (x{count})")
145145
}),
146146
", "
147147
)
@@ -204,31 +204,31 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
204204
if let Some(info_by_type) = info.get(&Type::Audio) {
205205
map! { @extend values
206206
"icon_audio" => Value::icon("microphone"),
207-
"info_audio" => Value::text(format!("{}", info_by_type))
207+
"info_audio" => Value::text(info_by_type.to_string())
208208
}
209209
}
210210
if let Some(info_by_type) = info.get(&Type::AudioSink) {
211211
map! { @extend values
212212
"icon_audio_sink" => Value::icon("volume"),
213-
"info_audio_sink" => Value::text(format!("{}", info_by_type))
213+
"info_audio_sink" => Value::text(info_by_type.to_string())
214214
}
215215
}
216216
if let Some(info_by_type) = info.get(&Type::Video) {
217217
map! { @extend values
218218
"icon_video" => Value::icon("xrandr"),
219-
"info_video" => Value::text(format!("{}", info_by_type))
219+
"info_video" => Value::text(info_by_type.to_string())
220220
}
221221
}
222222
if let Some(info_by_type) = info.get(&Type::Webcam) {
223223
map! { @extend values
224224
"icon_webcam" => Value::icon("webcam"),
225-
"info_webcam" => Value::text(format!("{}", info_by_type))
225+
"info_webcam" => Value::text(info_by_type.to_string())
226226
}
227227
}
228228
if let Some(info_by_type) = info.get(&Type::Unknown) {
229229
map! { @extend values
230230
"icon_unknown" => Value::icon("unknown"),
231-
"info_unknown" => Value::text(format!("{}", info_by_type))
231+
"info_unknown" => Value::text(info_by_type.to_string())
232232
}
233233
}
234234

src/blocks/privacy/pipewire.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Node {
2929
Self {
3030
name: global_props
3131
.get(&keys::NODE_NAME)
32-
.map_or_else(|| format!("node_{}", global_id), |s| s.to_string()),
32+
.map_or_else(|| format!("node_{global_id}"), |s| s.to_string()),
3333
nick: global_props.get(&keys::NODE_NICK).map(|s| s.to_string()),
3434
media_class: global_props.get(&keys::MEDIA_CLASS).map(|s| s.to_string()),
3535
media_role: global_props.get(&keys::MEDIA_ROLE).map(|s| s.to_string()),

src/formatting/formatter/duration.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ impl DurationFormatter {
118118
// UNITS are sorted largest to smallest
119119
if min_unit_index < max_unit_index {
120120
return Err(Error::new(format!(
121-
"min_unit({}) must be smaller than or equal to max_unit({})",
122-
min_unit, max_unit,
121+
"min_unit({min_unit}) must be smaller than or equal to max_unit({max_unit})",
123122
)));
124123
}
125124

@@ -128,8 +127,7 @@ impl DurationFormatter {
128127

129128
if units > units_upper_bound {
130129
return Err(Error::new(format!(
131-
"there aren't {} units between min_unit({}) and max_unit({})",
132-
units, min_unit, max_unit,
130+
"there aren't {units} units between min_unit({min_unit}) and max_unit({max_unit})",
133131
)));
134132
}
135133

0 commit comments

Comments
 (0)