Skip to content

Commit

Permalink
Fix clippy and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Jul 1, 2024
1 parent daaf92d commit 24c5a1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/copyright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# -g "!src/special_directory"

# Check all the standard Rust source files
output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Xilem Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0$\n\n" --files-without-match --multiline -g "*.rs" .)
# Exclude the Emoji picker example because it also has some MIT licensed content
output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Xilem Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0$\n\n" --files-without-match --multiline -g "*.rs" -g "!xilem/examples/emoji_picker.rs" .)

if [ -n "$output" ]; then
echo -e "The following files lack the correct copyright header:\n"
Expand Down
12 changes: 6 additions & 6 deletions xilem/examples/emoji_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fn app_logic(data: &mut EmojiPagination) -> impl WidgetView<EmojiPagination> {
flex((
// TODO: Expose that this is a "zoom out" button accessibly
button("🔍-", |data: &mut EmojiPagination| {
data.size = (data.size + 1).min(5)
data.size = (data.size + 1).min(5);
}),
// TODO: Expose that this is a "zoom in" button accessibly
button("🔍+", |data: &mut EmojiPagination| {
data.size = (data.size - 1).max(2)
data.size = (data.size - 1).max(2);
}),
))
.direction(Axis::Horizontal),
Expand Down Expand Up @@ -60,7 +60,7 @@ fn picker(data: &mut EmojiPagination) -> impl WidgetView<EmojiPagination> {
let view = flex((
// TODO: Expose that this button corresponds to the label below to accessibility?
sized_box(button(emoji.display, move |data: &mut EmojiPagination| {
data.last_selected = Some(idx)
data.last_selected = Some(idx);
}))
.expand_width(),
sized_box(
Expand All @@ -83,7 +83,7 @@ fn picker(data: &mut EmojiPagination) -> impl WidgetView<EmojiPagination> {
};
row_contents.push(sized_box(view).width(dimensions).height(dimensions));
}
result.push(flex(row_contents).direction(Axis::Horizontal))
result.push(flex(row_contents).direction(Axis::Horizontal));
}

flex(result)
Expand All @@ -99,13 +99,13 @@ fn paginate(
flex((
// TODO: Expose that this is a previous page button to accessibility
button("<-", move |data| {
*data = current_start.saturating_sub(count_per_page)
*data = current_start.saturating_sub(count_per_page);
}),
label(format!("{percentage}%")),
button("->", move |data| {
let new_idx = current_start + count_per_page;
if new_idx < max_count {
*data = new_idx
*data = new_idx;
}
}),
))
Expand Down

0 comments on commit 24c5a1d

Please sign in to comment.