Skip to content

Commit ce19043

Browse files
Fix Clippy warnings
1 parent 46b9de7 commit ce19043

30 files changed

Lines changed: 195 additions & 208 deletions

File tree

packages/core/src/middleware/offset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn convert_value_to_coords<Element: Clone, Window: Clone>(
4545
if let Some(alignment_axis) = alignment_axis {
4646
cross_axis = match alignment {
4747
Alignment::Start => alignment_axis,
48-
Alignment::End => alignment_axis * -1.0,
48+
Alignment::End => -alignment_axis,
4949
};
5050
}
5151
}

packages/leptos/example/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ pub fn App() -> impl IntoView {
4545
let arrow_x = Signal::derive(move || {
4646
arrow_data
4747
.get()
48-
.and_then(|arrow_data| arrow_data.x.map(|x| format!("{}px", x)))
48+
.and_then(|arrow_data| arrow_data.x.map(|x| format!("{x}px")))
4949
});
5050
let arrow_y = Signal::derive(move || {
5151
arrow_data
5252
.get()
53-
.and_then(|arrow_data| arrow_data.y.map(|y| format!("{}px", y)))
53+
.and_then(|arrow_data| arrow_data.y.map(|y| format!("{y}px")))
5454
});
5555

5656
view! {

packages/leptos/src/types.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,12 @@ impl Display for FloatingStyles {
202202
self.transform
203203
.as_ref()
204204
.map_or("".to_owned(), |transform| format!(
205-
" transform: {};",
206-
transform
205+
" transform: {transform};"
207206
),),
208207
self.will_change
209208
.as_ref()
210209
.map_or("".to_owned(), |will_change| format!(
211-
" will-change: {};",
212-
will_change
210+
" will-change: {will_change};"
213211
))
214212
)
215213
}

packages/leptos/tests/visual/src/spec/arrow.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn Arrow() -> impl IntoView {
9999
style:top=move || match static_side() {
100100
Side::Top => "-15px".to_owned(),
101101
_ => match arrow_y() {
102-
Some(arrow_y) => format!("{}px", arrow_y),
102+
Some(arrow_y) => format!("{arrow_y}px"),
103103
None => "".to_owned()
104104
}
105105
}
@@ -114,7 +114,7 @@ pub fn Arrow() -> impl IntoView {
114114
style:left=move || match static_side() {
115115
Side::Left => "-15px".to_owned(),
116116
_ => match arrow_x() {
117-
Some(arrow_x) => format!("{}px", arrow_x),
117+
Some(arrow_x) => format!("{arrow_x}px"),
118118
None => "".to_owned()
119119
}
120120
}
@@ -129,7 +129,7 @@ pub fn Arrow() -> impl IntoView {
129129
style:top=move || match static_side() {
130130
Side::Top => "-15px".to_owned(),
131131
_ => match arrow_y() {
132-
Some(arrow_y) => format!("{}px", arrow_y),
132+
Some(arrow_y) => format!("{arrow_y}px"),
133133
None => "".to_owned()
134134
}
135135
}
@@ -144,7 +144,7 @@ pub fn Arrow() -> impl IntoView {
144144
style:left=move || match static_side() {
145145
Side::Left => "-15px".to_owned(),
146146
_ => match arrow_x() {
147-
Some(arrow_x) => format!("{}px", arrow_x),
147+
Some(arrow_x) => format!("{arrow_x}px"),
148148
None => "".to_owned()
149149
}
150150
}
@@ -216,7 +216,7 @@ pub fn Arrow() -> impl IntoView {
216216
<div class="controls">
217217
<For
218218
each=|| [25, 125]
219-
key=|size| format!("{:?}", size)
219+
key=|size| format!("{size:?}")
220220
children=move |size| view! {
221221
<button
222222
data-testid=format!("reference-{size}")
@@ -237,7 +237,7 @@ pub fn Arrow() -> impl IntoView {
237237
<div class="controls">
238238
<For
239239
each=|| [75, 150]
240-
key=|size| format!("{:?}", size)
240+
key=|size| format!("{size:?}")
241241
children=move |size| view! {
242242
<button
243243
data-testid=format!("floating-{size}")
@@ -258,7 +258,7 @@ pub fn Arrow() -> impl IntoView {
258258
<div class="controls">
259259
<For
260260
each=|| [0, 20, 200]
261-
key=|size| format!("{:?}", size)
261+
key=|size| format!("{size:?}")
262262
children={
263263
let update_scroll = update_scroll.clone();
264264

@@ -294,7 +294,7 @@ pub fn Arrow() -> impl IntoView {
294294
<div class="controls">
295295
<For
296296
each=|| [true, false]
297-
key=|value| format!("{}", value)
297+
key=|value| format!("{value}")
298298
children={
299299
let update_scroll = update_scroll.clone();
300300

@@ -318,7 +318,7 @@ pub fn Arrow() -> impl IntoView {
318318
}
319319
}
320320
>
321-
{format!("{}", value)}
321+
{format!("{value}")}
322322
</button>
323323
}
324324
}
@@ -330,14 +330,14 @@ pub fn Arrow() -> impl IntoView {
330330
<div class="controls">
331331
<For
332332
each=|| ALL_PLACEMENTS
333-
key=|local_placement| format!("{:?}", local_placement)
333+
key=|local_placement| format!("{local_placement:?}")
334334
children={
335335
let update_scroll = update_scroll.clone();
336336

337337
move |local_placement| {
338338
view! {
339339
<button
340-
data-testid=format!("Placement{:?}", local_placement).to_case(Case::Kebab)
340+
data-testid=format!("Placement{local_placement:?}").to_case(Case::Kebab)
341341
style:background-color=move || if placement.get() == local_placement {
342342
"black"
343343
} else {
@@ -354,7 +354,7 @@ pub fn Arrow() -> impl IntoView {
354354
}
355355
}
356356
>
357-
{format!("{:?}", local_placement).to_case(Case::Kebab)}
357+
{format!("{local_placement:?}").to_case(Case::Kebab)}
358358
</button>
359359
}
360360
}
@@ -366,7 +366,7 @@ pub fn Arrow() -> impl IntoView {
366366
<div class="controls">
367367
<For
368368
each=|| [true, false]
369-
key=|value| format!("{}", value)
369+
key=|value| format!("{value}")
370370
children=move |value| view! {
371371
<button
372372
data-testid=format!("svg-{}", value)
@@ -377,7 +377,7 @@ pub fn Arrow() -> impl IntoView {
377377
}
378378
on:click=move |_| set_svg.set(value)
379379
>
380-
{format!("{}", value)}
380+
{format!("{value}")}
381381
</button>
382382
}
383383
/>
@@ -387,7 +387,7 @@ pub fn Arrow() -> impl IntoView {
387387
<div class="controls">
388388
<For
389389
each=|| [true, false]
390-
key=|value| format!("{}", value)
390+
key=|value| format!("{value}")
391391
children=move |value| view! {
392392
<button
393393
data-testid=format!("nested-{}", value)
@@ -398,7 +398,7 @@ pub fn Arrow() -> impl IntoView {
398398
}
399399
on:click=move |_| set_nested.set(value)
400400
>
401-
{format!("{}", value)}
401+
{format!("{value}")}
402402
</button>
403403
}
404404
/>
@@ -408,7 +408,7 @@ pub fn Arrow() -> impl IntoView {
408408
<div class="controls">
409409
<For
410410
each=|| [true, false]
411-
key=|value| format!("{}", value)
411+
key=|value| format!("{value}")
412412
children={
413413
let update_scroll = update_scroll.clone();
414414

@@ -443,7 +443,7 @@ pub fn Arrow() -> impl IntoView {
443443
}
444444
}
445445
>
446-
{format!("{}", value)}
446+
{format!("{value}")}
447447
</button>
448448
}
449449
}

packages/leptos/tests/visual/src/spec/auto_placement.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn AutoPlacement() -> impl IntoView {
109109
<div
110110
node_ref=reference_ref
111111
class="reference"
112-
style=move || add_shift.get().then_some("width: 50px; height: 25px;").unwrap_or_default()
112+
style=move || if add_shift.get() { "width: 50px; height: 25px;" } else { Default::default() }
113113
>
114114
Reference
115115
</div>
@@ -119,8 +119,8 @@ pub fn AutoPlacement() -> impl IntoView {
119119
style:position=move || format!("{:?}", strategy.get()).to_lowercase()
120120
style:top=move || format!("{}px", y.get())
121121
style:left=move || format!("{}px", x.get())
122-
style:width=move || add_shift.get().then_some("250px").unwrap_or_default()
123-
style:height=move || add_shift.get().then_some("250px").unwrap_or_default()
122+
style:width=move || if add_shift.get() { "250px" } else { Default::default() }
123+
style:height=move || if add_shift.get() { "250px" } else { Default::default() }
124124
>
125125
Floating
126126
</div>
@@ -131,12 +131,12 @@ pub fn AutoPlacement() -> impl IntoView {
131131
<div class="controls">
132132
<For
133133
each=|| ALL_ALIGNMENTS
134-
key=|local_alignment| format!("{:?}", local_alignment)
134+
key=|local_alignment| format!("{local_alignment:?}")
135135
children=move |local_alignment| view! {
136136
<button
137137
data-testid=move || format!("alignment-{}", match local_alignment {
138138
None => "null".to_owned(),
139-
Some(local_alignment) => format!("{:?}", local_alignment).to_case(Case::Camel)
139+
Some(local_alignment) => format!("{local_alignment:?}").to_case(Case::Camel)
140140
})
141141
style:background-color=move || if alignment.get() == local_alignment {
142142
"black"
@@ -147,7 +147,7 @@ pub fn AutoPlacement() -> impl IntoView {
147147
>
148148
{match local_alignment {
149149
None => "null".to_owned(),
150-
Some(local_alignment) => format!("{:?}", local_alignment).to_case(Case::Camel)
150+
Some(local_alignment) => format!("{local_alignment:?}").to_case(Case::Camel)
151151
}}
152152
</button>
153153
}
@@ -158,7 +158,7 @@ pub fn AutoPlacement() -> impl IntoView {
158158
<div class="controls">
159159
<For
160160
each=|| [true, false]
161-
key=|value| format!("{}", value)
161+
key=|value| format!("{value}")
162162
children=move |value| {
163163
view! {
164164
<button
@@ -170,7 +170,7 @@ pub fn AutoPlacement() -> impl IntoView {
170170
}
171171
on:click=move |_| set_auto_alignment.set(value)
172172
>
173-
{format!("{}", value)}
173+
{format!("{value}")}
174174
</button>
175175
}
176176
}
@@ -181,13 +181,13 @@ pub fn AutoPlacement() -> impl IntoView {
181181
<div class="controls">
182182
<For
183183
each=|| ALL_ALLOWED_PLACEMENTS
184-
key=|local_allowed_placements| format!("{:?}", local_allowed_placements)
184+
key=|local_allowed_placements| format!("{local_allowed_placements:?}")
185185
children=move |local_allowed_placements| {
186186
view! {
187187
<button
188188
data-testid=move || format!("allowedPlacements-{}", match local_allowed_placements {
189189
AllowedPlacements::None => "undefined".to_owned(),
190-
_ => format!("{:?}", local_allowed_placements).replace("Comma", ",").to_case(Case::Kebab)
190+
_ => format!("{local_allowed_placements:?}").replace("Comma", ",").to_case(Case::Kebab)
191191
})
192192
style:background-color=move || if allowed_placements.get() == local_allowed_placements {
193193
"black"
@@ -198,7 +198,7 @@ pub fn AutoPlacement() -> impl IntoView {
198198
>
199199
{match local_allowed_placements {
200200
AllowedPlacements::None => "undefined".to_owned(),
201-
_ => format!("{:?}", local_allowed_placements).replace("Comma", ",").to_case(Case::Kebab)
201+
_ => format!("{local_allowed_placements:?}").replace("Comma", ",").to_case(Case::Kebab)
202202
}}
203203
</button>
204204
}
@@ -210,7 +210,7 @@ pub fn AutoPlacement() -> impl IntoView {
210210
<div class="controls">
211211
<For
212212
each=|| [true, false]
213-
key=|value| format!("{}", value)
213+
key=|value| format!("{value}")
214214
children=move |value| {
215215
view! {
216216
<button
@@ -222,7 +222,7 @@ pub fn AutoPlacement() -> impl IntoView {
222222
}
223223
on:click=move |_| set_cross_axis.set(value)
224224
>
225-
{format!("{}", value)}
225+
{format!("{value}")}
226226
</button>
227227
}
228228
}
@@ -233,7 +233,7 @@ pub fn AutoPlacement() -> impl IntoView {
233233
<div class="controls">
234234
<For
235235
each=|| [true, false]
236-
key=|value| format!("{}", value)
236+
key=|value| format!("{value}")
237237
children=move |value| {
238238
view! {
239239
<button
@@ -245,7 +245,7 @@ pub fn AutoPlacement() -> impl IntoView {
245245
}
246246
on:click=move |_| set_add_shift.set(value)
247247
>
248-
{format!("{}", value)}
248+
{format!("{value}")}
249249
</button>
250250
}
251251
}

0 commit comments

Comments
 (0)