Skip to content

Commit

Permalink
clippy: Fix semicolon_if_nothing_returned lints. (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Mar 9, 2024
1 parent 8f7f5db commit a0db0a4
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion crates/xilem_web/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<T: 'static, V: View<T> + 'static, F: FnMut(&mut T) -> V + 'static> App<T, V
pub fn run(self, root: &web_sys::HtmlElement) {
self.0.borrow_mut().ensure_app(root);
// Latter may not be necessary, we have an rc loop.
std::mem::forget(self)
std::mem::forget(self);
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/xilem_web/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ fn set_attribute(element: &web_sys::Element, name: &str, value: &str) {
// doesn't work after the value has been changed.
if name == "value" {
let element: &web_sys::HtmlInputElement = element.dyn_ref().unwrap_throw();
element.set_value(value)
element.set_value(value);
} else if name == "checked" {
let element: &web_sys::HtmlInputElement = element.dyn_ref().unwrap_throw();
element.set_checked(true)
element.set_checked(true);
} else {
element.set_attribute(name, value).unwrap_throw();
}
Expand All @@ -35,7 +35,7 @@ fn remove_attribute(element: &web_sys::Element, name: &str) {
// doesn't work after the value has been changed.
if name == "checked" {
let element: &web_sys::HtmlInputElement = element.dyn_ref().unwrap_throw();
element.set_checked(false)
element.set_checked(false);
} else {
element.remove_attribute(name).unwrap_throw();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/xilem_web/src/vecmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<K, V> VecMap<K, V> {
}

pub fn clear(&mut self) {
self.0.clear()
self.0.clear();
}

/// Returns `true` if the map contains no elements.
Expand Down
4 changes: 2 additions & 2 deletions crates/xilem_web/web_examples/todomvc/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl AppState {
if let Some(ref mut todo) = self.todos.iter_mut().find(|todo| todo.id == id) {
todo.title_editing.clear();
todo.title_editing.push_str(&todo.title);
self.editing_id = Some(id)
self.editing_id = Some(id);
}
}

Expand All @@ -96,7 +96,7 @@ impl AppState {
/// Save the current state to local_storage
pub fn save(&self) {
let raw = serde_json::to_string(self).unwrap_throw();
storage().set_item(KEY, &raw).unwrap_throw()
storage().set_item(KEY, &raw).unwrap_throw();
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn app_logic(data: &mut AppData) -> impl View<AppData> {
data.count = 0;
}),
switch(data.is_on, |data: &mut AppData, value: bool| {
data.is_on = value
data.is_on = value;
}),
)),
))
Expand Down Expand Up @@ -55,5 +55,5 @@ fn main() {
};

let app = App::new(data, app_logic);
AppLauncher::new(app).run()
AppLauncher::new(app).run();
}
2 changes: 1 addition & 1 deletion examples/taffy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ fn app_logic(state: &mut AppState) -> impl View<AppState> {

fn main() {
let app = App::new(AppState::new(), app_logic);
AppLauncher::new(app).run()
AppLauncher::new(app).run();
}
2 changes: 1 addition & 1 deletion src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Axis {

/// Updates the scalar of value on the orthogonal axis.
pub fn set_minor<T: Dim2>(self, value: &mut T, major: T::Scalar) {
self.cross().set_major(value, major)
self.cross().set_major(value, major);
}

/// Maps the scalar of the value on this axis.
Expand Down
4 changes: 2 additions & 2 deletions src/view/taffy_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl<T, A, VT: ViewSequence<T, A>> View<T, A> for TaffyLayout<T, A, VT> {

if self.background_color != prev.background_color {
element.background_color = self.background_color;
flags |= ChangeFlags::PAINT
flags |= ChangeFlags::PAINT;
}

if self.style != prev.style {
Expand All @@ -137,7 +137,7 @@ impl<T, A, VT: ViewSequence<T, A>> View<T, A> for TaffyLayout<T, A, VT> {

// Clear layout cache if the layout ChangeFlag is set
if flags.contains(ChangeFlags::LAYOUT) || flags.contains(ChangeFlags::TREE) {
element.cache.clear()
element.cache.clear();
}

flags
Expand Down
2 changes: 1 addition & 1 deletion src/widget/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Widget for Button {

fn lifecycle(&mut self, cx: &mut LifeCycleCx, event: &LifeCycle) {
if let LifeCycle::HotChanged(_) = event {
cx.request_paint()
cx.request_paint();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/widget/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl WidgetState {
}

fn request(&mut self, flags: PodFlags) {
self.flags |= flags
self.flags |= flags;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/widget/piet_scene_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn stroke<'b>(
brush,
None,
path,
)
);
}

// Note: copied from piet
Expand Down Expand Up @@ -77,5 +77,5 @@ pub fn fill_lin_gradient(
}

pub fn fill_color(scene: &mut Scene, path: &impl Shape, color: Color) {
scene.fill(Fill::NonZero, Affine::IDENTITY, color, None, path)
scene.fill(Fill::NonZero, Affine::IDENTITY, color, None, path);
}
2 changes: 1 addition & 1 deletion src/widget/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Widget for Switch {
Event::MouseUp(_) => {
if self.is_dragging {
if self.is_on != (self.knob_position.x > SWITCH_WIDTH / 2.0) {
cx.add_message(Message::new(self.id_path.clone(), ()))
cx.add_message(Message::new(self.id_path.clone(), ()));
}
} else if cx.is_active() {
cx.add_message(Message::new(self.id_path.clone(), ()));
Expand Down

0 comments on commit a0db0a4

Please sign in to comment.