Fix clippy::semicolon_if_nothing_returned

This commit is contained in:
Héctor Ramón Jiménez 2023-09-20 04:11:52 +02:00
parent 9991052ce5
commit 34f07b6027
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
46 changed files with 108 additions and 108 deletions

View file

@ -146,7 +146,7 @@ where
}
fn diff(&self, tree: &mut Tree) {
tree.diff_children(std::slice::from_ref(&self.content))
tree.diff_children(std::slice::from_ref(&self.content));
}
fn width(&self) -> Length {

View file

@ -159,7 +159,7 @@ where
child
.as_widget()
.operate(state, layout, renderer, operation);
})
});
});
}

View file

@ -141,14 +141,14 @@ pub fn draw<Renderer, Handle>(
..bounds
};
renderer.draw(handle.clone(), drawing_bounds + offset)
renderer.draw(handle.clone(), drawing_bounds + offset);
};
if adjusted_fit.width > bounds.width || adjusted_fit.height > bounds.height
{
renderer.with_layer(bounds, render);
} else {
render(renderer)
render(renderer);
}
}
@ -191,7 +191,7 @@ where
_cursor: mouse::Cursor,
_viewport: &Rectangle,
) {
draw(renderer, layout, &self.handle, self.content_fit)
draw(renderer, layout, &self.handle, self.content_fit);
}
}

View file

@ -334,7 +334,7 @@ where
y: bounds.y,
..Rectangle::with_size(image_size)
},
)
);
});
});
}

View file

@ -220,7 +220,7 @@ where
child
.as_widget()
.operate(state, layout, renderer, operation);
})
});
});
}

View file

@ -135,7 +135,7 @@ where
(*self.element.borrow_mut()) = Some(current.element.clone());
self.with_element(|element| {
tree.diff_children(std::slice::from_ref(&element.as_widget()))
tree.diff_children(std::slice::from_ref(&element.as_widget()));
});
} else {
(*self.element.borrow_mut()) = Some(current.element.clone());
@ -243,8 +243,8 @@ where
layout,
cursor,
viewport,
)
})
);
});
}
fn overlay<'b>(

View file

@ -240,9 +240,9 @@ where
|tree, renderer, layout, element| {
element.as_widget().draw(
tree, renderer, theme, style, layout, cursor, viewport,
)
);
},
)
);
}
fn mouse_interaction(

View file

@ -308,7 +308,7 @@ where
.zip(layout.children())
.for_each(|(((_pane, content), state), layout)| {
content.operate(state, layout, renderer, operation);
})
});
});
}
@ -436,7 +436,7 @@ where
tree, renderer, theme, style, layout, cursor, rectangle,
);
},
)
);
}
fn overlay<'b>(

View file

@ -156,16 +156,16 @@ impl<T> State<T> {
Region::Center => self.swap(pane, target),
Region::Edge(edge) => match edge {
Edge::Top => {
self.split_and_swap(Axis::Horizontal, target, pane, true)
self.split_and_swap(Axis::Horizontal, target, pane, true);
}
Edge::Bottom => {
self.split_and_swap(Axis::Horizontal, target, pane, false)
self.split_and_swap(Axis::Horizontal, target, pane, false);
}
Edge::Left => {
self.split_and_swap(Axis::Vertical, target, pane, true)
self.split_and_swap(Axis::Vertical, target, pane, true);
}
Edge::Right => {
self.split_and_swap(Axis::Vertical, target, pane, false)
self.split_and_swap(Axis::Vertical, target, pane, false);
}
},
}
@ -176,7 +176,7 @@ impl<T> State<T> {
match target {
Target::Edge(edge) => self.move_to_edge(pane, edge),
Target::Pane(target, region) => {
self.split_with(&target, pane, region)
self.split_with(&target, pane, region);
}
}
}
@ -241,16 +241,16 @@ impl<T> State<T> {
pub fn move_to_edge(&mut self, pane: &Pane, edge: Edge) {
match edge {
Edge::Top => {
self.split_major_node_and_swap(Axis::Horizontal, pane, true)
self.split_major_node_and_swap(Axis::Horizontal, pane, true);
}
Edge::Bottom => {
self.split_major_node_and_swap(Axis::Horizontal, pane, false)
self.split_major_node_and_swap(Axis::Horizontal, pane, false);
}
Edge::Left => {
self.split_major_node_and_swap(Axis::Vertical, pane, true)
self.split_major_node_and_swap(Axis::Vertical, pane, true);
}
Edge::Right => {
self.split_major_node_and_swap(Axis::Vertical, pane, false)
self.split_major_node_and_swap(Axis::Vertical, pane, false);
}
}
}

View file

@ -286,7 +286,7 @@ where
controls_layout,
renderer,
operation,
)
);
};
if show_title {
@ -295,7 +295,7 @@ where
title_layout,
renderer,
operation,
)
);
}
}

View file

@ -253,7 +253,7 @@ where
&self.handle,
&self.style,
|| tree.state.downcast_ref::<State<Renderer::Paragraph>>(),
)
);
}
fn overlay<'b>(

View file

@ -101,7 +101,7 @@ where
}
fn diff(&self, tree: &mut Tree) {
tree.diff_children(&self.children)
tree.diff_children(&self.children);
}
fn width(&self) -> Length {
@ -148,7 +148,7 @@ where
child
.as_widget()
.operate(state, layout, renderer, operation);
})
});
});
}

View file

@ -217,7 +217,7 @@ where
}
fn diff(&self, tree: &mut Tree) {
tree.diff_children(std::slice::from_ref(&self.content))
tree.diff_children(std::slice::from_ref(&self.content));
}
fn width(&self) -> Length {
@ -348,9 +348,9 @@ where
layout,
cursor,
viewport,
)
);
},
)
);
}
fn mouse_interaction(
@ -1069,7 +1069,7 @@ impl operation::Scrollable for State {
}
fn scroll_to(&mut self, offset: AbsoluteOffset) {
State::scroll_to(self, offset)
State::scroll_to(self, offset);
}
}
@ -1203,7 +1203,7 @@ impl State {
(self.offset_y.absolute(bounds.height, content_bounds.height)
- delta.y)
.clamp(0.0, content_bounds.height - bounds.height),
)
);
}
if bounds.width < content_bounds.width {

View file

@ -223,7 +223,7 @@ where
&self.range,
theme,
&self.style,
)
);
}
fn mouse_interaction(

View file

@ -250,7 +250,7 @@ where
self.is_secure,
self.icon.as_ref(),
&self.style,
)
);
}
}
@ -375,7 +375,7 @@ where
self.is_secure,
self.icon.as_ref(),
&self.style,
)
);
}
fn mouse_interaction(
@ -622,7 +622,7 @@ where
font,
size,
line_height,
)
);
};
match event {
@ -849,7 +849,7 @@ where
state.cursor.move_left_by_words(value);
}
} else if modifiers.shift() {
state.cursor.select_left(value)
state.cursor.select_left(value);
} else {
state.cursor.move_left(value);
}
@ -864,7 +864,7 @@ where
state.cursor.move_right_by_words(value);
}
} else if modifiers.shift() {
state.cursor.select_right(value)
state.cursor.select_right(value);
} else {
state.cursor.move_right(value);
}
@ -1220,7 +1220,7 @@ pub fn draw<Renderer>(
if text_width > text_bounds.width {
renderer.with_layer(text_bounds, |renderer| {
renderer.with_translation(Vector::new(-offset, 0.0), render)
renderer.with_translation(Vector::new(-offset, 0.0), render);
});
} else {
render(renderer);
@ -1342,29 +1342,29 @@ impl<P: text::Paragraph> operation::Focusable for State<P> {
}
fn focus(&mut self) {
State::focus(self)
State::focus(self);
}
fn unfocus(&mut self) {
State::unfocus(self)
State::unfocus(self);
}
}
impl<P: text::Paragraph> operation::TextInput for State<P> {
fn move_cursor_to_front(&mut self) {
State::move_cursor_to_front(self)
State::move_cursor_to_front(self);
}
fn move_cursor_to_end(&mut self) {
State::move_cursor_to_end(self)
State::move_cursor_to_end(self);
}
fn move_cursor_to(&mut self, position: usize) {
State::move_cursor_to(self, position)
State::move_cursor_to(self, position);
}
fn select_all(&mut self) {
State::select_all(self)
State::select_all(self);
}
}

View file

@ -65,11 +65,11 @@ impl Cursor {
}
pub(crate) fn move_right(&mut self, value: &Value) {
self.move_right_by_amount(value, 1)
self.move_right_by_amount(value, 1);
}
pub(crate) fn move_right_by_words(&mut self, value: &Value) {
self.move_to(value.next_end_of_word(self.right(value)))
self.move_to(value.next_end_of_word(self.right(value)));
}
pub(crate) fn move_right_by_amount(
@ -79,7 +79,7 @@ impl Cursor {
) {
match self.state(value) {
State::Index(index) => {
self.move_to(index.saturating_add(amount).min(value.len()))
self.move_to(index.saturating_add(amount).min(value.len()));
}
State::Selection { start, end } => self.move_to(end.max(start)),
}
@ -108,10 +108,10 @@ impl Cursor {
pub(crate) fn select_left(&mut self, value: &Value) {
match self.state(value) {
State::Index(index) if index > 0 => {
self.select_range(index, index - 1)
self.select_range(index, index - 1);
}
State::Selection { start, end } if end > 0 => {
self.select_range(start, end - 1)
self.select_range(start, end - 1);
}
_ => {}
}
@ -120,10 +120,10 @@ impl Cursor {
pub(crate) fn select_right(&mut self, value: &Value) {
match self.state(value) {
State::Index(index) if index < value.len() => {
self.select_range(index, index + 1)
self.select_range(index, index + 1);
}
State::Selection { start, end } if end < value.len() => {
self.select_range(start, end + 1)
self.select_range(start, end + 1);
}
_ => {}
}
@ -132,10 +132,10 @@ impl Cursor {
pub(crate) fn select_left_by_words(&mut self, value: &Value) {
match self.state(value) {
State::Index(index) => {
self.select_range(index, value.previous_start_of_word(index))
self.select_range(index, value.previous_start_of_word(index));
}
State::Selection { start, end } => {
self.select_range(start, value.previous_start_of_word(end))
self.select_range(start, value.previous_start_of_word(end));
}
}
}
@ -143,10 +143,10 @@ impl Cursor {
pub(crate) fn select_right_by_words(&mut self, value: &Value) {
match self.state(value) {
State::Index(index) => {
self.select_range(index, value.next_end_of_word(index))
self.select_range(index, value.next_end_of_word(index));
}
State::Selection { start, end } => {
self.select_range(start, value.next_end_of_word(end))
self.select_range(start, value.next_end_of_word(end));
}
}
}

View file

@ -114,7 +114,7 @@ where
}
fn diff(&self, tree: &mut widget::Tree) {
tree.diff_children(&[self.content.as_widget(), &self.tooltip])
tree.diff_children(&[self.content.as_widget(), &self.tooltip]);
}
fn state(&self) -> widget::tree::State {

View file

@ -220,7 +220,7 @@ where
&self.range,
theme,
&self.style,
)
);
}
fn mouse_interaction(