Fix a lot of Clippy warnings (#1808)

* fix a lot of clippy warnings

* fix more clippy warnings

* fix yet more clippy warnings

* bump msrv to 1.70.0 to silence warnings

* fix a lot of clippy warnings

* fix more clippy warnings

* fix yet more clippy warnings

* fix a few more warnings

* fix a clippy warning

* remove a commented out line

* silense too many arguments error

* fix more clippy warnings

* prefix underscore to unused vars/functions to fix warnings

* use filter instead of map

* move raw-rs-tests feature flat to module level to fix unused imports warnings

* fix a couple of unused result warnings

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Raminder Singh
2024-07-09 05:02:52 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent f7ada701e5
commit 62f73df048
49 changed files with 264 additions and 260 deletions
@@ -161,11 +161,11 @@ impl LayoutMessageHandler {
Widget::DropdownInput(dropdown_input) => {
let callback_message = match action {
WidgetValueAction::Commit => {
let update_value = value.as_u64().expect(&format!("DropdownInput commit was not of type `u64`, found {value:?}"));
let update_value = value.as_u64().unwrap_or_else(|| panic!("DropdownInput commit was not of type `u64`, found {value:?}"));
(dropdown_input.entries.iter().flatten().nth(update_value as usize).unwrap().on_commit.callback)(&())
}
WidgetValueAction::Update => {
let update_value = value.as_u64().expect(&format!("DropdownInput update was not of type `u64`, found {value:?}"));
let update_value = value.as_u64().unwrap_or_else(|| panic!("DropdownInput update was not of type `u64`, found {value:?}"));
dropdown_input.selected_index = Some(update_value as u32);
(dropdown_input.entries.iter().flatten().nth(update_value as usize).unwrap().on_update.callback)(&())
}
@@ -186,7 +186,7 @@ impl WidgetLayout {
// TODO: Diff insersion and deletion of items
if self.layout.len() != new.layout.len() {
// Update the layout to the new layout
self.layout = new.layout.clone();
self.layout.clone_from(&new.layout);
// Push an update sublayout to the diff
let new = DiffUpdate::SubLayout(new.layout);
@@ -342,7 +342,7 @@ impl LayoutGroup {
Widget::InvisibleStandinInput(_) | Widget::PivotInput(_) | Widget::RadioInput(_) | Widget::Separator(_) | Widget::WorkingColorsInput(_) => continue,
};
if val.is_empty() {
*val = tooltip.clone();
val.clone_from(&tooltip);
}
}
if is_col {
@@ -361,7 +361,7 @@ impl LayoutGroup {
// TODO: Diff insersion and deletion of items
if current_widgets.len() != new_widgets.len() {
// Update to the new value
*current_widgets = new_widgets.clone();
current_widgets.clone_from(&new_widgets);
// Push back a LayoutGroup update to the diff
let new_value = DiffUpdate::LayoutGroup(if is_column { Self::Column { widgets: new_widgets } } else { Self::Row { widgets: new_widgets } });
@@ -394,10 +394,10 @@ impl LayoutGroup {
// TODO: Diff insersion and deletion of items
if current_layout.len() != new_layout.len() || *current_name != new_name || *current_visible != new_visible || *current_id != new_id {
// Update self to reflect new changes
*current_name = new_name.clone();
current_name.clone_from(&new_name);
*current_visible = new_visible;
*current_id = new_id;
*current_layout = new_layout.clone();
current_layout.clone_from(&new_layout);
// Push an update layout group to the diff
let new_value = DiffUpdate::LayoutGroup(Self::Section {