Fix clippy::semicolon_if_nothing_returned
This commit is contained in:
parent
9991052ce5
commit
34f07b6027
46 changed files with 108 additions and 108 deletions
|
|
@ -293,7 +293,7 @@ where
|
|||
}
|
||||
|
||||
fn diff(&self, tree: &mut Tree) {
|
||||
self.widget.diff(tree)
|
||||
self.widget.diff(tree);
|
||||
}
|
||||
|
||||
fn width(&self) -> Length {
|
||||
|
|
@ -418,7 +418,7 @@ where
|
|||
viewport: &Rectangle,
|
||||
) {
|
||||
self.widget
|
||||
.draw(tree, renderer, theme, style, layout, cursor, viewport)
|
||||
.draw(tree, renderer, theme, style, layout, cursor, viewport);
|
||||
}
|
||||
|
||||
fn mouse_interaction(
|
||||
|
|
@ -508,7 +508,7 @@ where
|
|||
) {
|
||||
self.element
|
||||
.widget
|
||||
.operate(state, layout, renderer, operation)
|
||||
.operate(state, layout, renderer, operation);
|
||||
}
|
||||
|
||||
fn on_event(
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ impl Linear {
|
|||
stops: impl IntoIterator<Item = ColorStop>,
|
||||
) -> Self {
|
||||
for stop in stops {
|
||||
self = self.add_stop(stop.offset, stop.color)
|
||||
self = self.add_stop(stop.offset, stop.color);
|
||||
}
|
||||
|
||||
self
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ pub struct Hasher(twox_hash::XxHash64);
|
|||
|
||||
impl core::hash::Hasher for Hasher {
|
||||
fn write(&mut self, bytes: &[u8]) {
|
||||
self.0.write(bytes)
|
||||
self.0.write(bytes);
|
||||
}
|
||||
|
||||
fn finish(&self) -> u64 {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ where
|
|||
layout: Layout<'_>,
|
||||
cursor: mouse::Cursor,
|
||||
) {
|
||||
self.overlay.draw(renderer, theme, style, layout, cursor)
|
||||
self.overlay.draw(renderer, theme, style, layout, cursor);
|
||||
}
|
||||
|
||||
/// Applies a [`widget::Operation`] to the [`Element`].
|
||||
|
|
@ -205,7 +205,7 @@ where
|
|||
state: &mut dyn widget::operation::TextInput,
|
||||
id: Option<&widget::Id>,
|
||||
) {
|
||||
self.operation.text_input(state, id)
|
||||
self.operation.text_input(state, id);
|
||||
}
|
||||
|
||||
fn custom(&mut self, state: &mut dyn Any, id: Option<&widget::Id>) {
|
||||
|
|
@ -262,7 +262,7 @@ where
|
|||
layout: Layout<'_>,
|
||||
cursor: mouse::Cursor,
|
||||
) {
|
||||
self.content.draw(renderer, theme, style, layout, cursor)
|
||||
self.content.draw(renderer, theme, style, layout, cursor);
|
||||
}
|
||||
|
||||
fn is_over(
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ where
|
|||
|(child, layout)| {
|
||||
child.operate(layout, renderer, operation);
|
||||
},
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl<'a, Message> Shell<'a, Message> {
|
|||
if self.is_layout_invalid {
|
||||
self.is_layout_invalid = false;
|
||||
|
||||
f()
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ pub fn focus<T>(target: Id) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ where
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
|
||||
fn finish(&self) -> Outcome<T> {
|
||||
|
|
@ -132,7 +132,7 @@ pub fn focus_previous<T>() -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ pub fn focus_next<T>() -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ pub fn find_focused() -> impl Operation<Id> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<Id>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
|
||||
fn finish(&self) -> Outcome<Id> {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ pub fn snap_to<T>(target: Id, offset: RelativeOffset) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
|
||||
fn scrollable(
|
||||
|
|
@ -60,7 +60,7 @@ pub fn scroll_to<T>(target: Id, offset: AbsoluteOffset) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
|
||||
fn scrollable(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ pub fn move_cursor_to_front<T>(target: Id) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ pub fn move_cursor_to_end<T>(target: Id) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ pub fn move_cursor_to<T>(target: Id, position: usize) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ pub fn select_all<T>(target: Id) -> impl Operation<T> {
|
|||
_bounds: Rectangle,
|
||||
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
|
||||
) {
|
||||
operate_on_children(self)
|
||||
operate_on_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl Tree {
|
|||
Renderer: crate::Renderer,
|
||||
{
|
||||
if self.tag == new.borrow().tag() {
|
||||
new.borrow().diff(self)
|
||||
new.borrow().diff(self);
|
||||
} else {
|
||||
*self = Self::new(new);
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ impl Tree {
|
|||
new_children,
|
||||
|tree, widget| tree.diff(widget.borrow()),
|
||||
|widget| Self::new(widget.borrow()),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/// Reconciliates the children of the tree with the provided list of widgets using custom
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ mod bezier {
|
|||
}
|
||||
|
||||
pub fn request_redraw(&mut self) {
|
||||
self.cache.clear()
|
||||
self.cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ impl<Message> canvas::Program<Message, Renderer> for Clock {
|
|||
frame.with_save(|frame| {
|
||||
frame.rotate(hand_rotation(self.now.second(), 60));
|
||||
frame.stroke(&long_hand, thin_stroke());
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
vec![clock]
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ mod toast {
|
|||
child
|
||||
.as_widget()
|
||||
.operate(state, layout, renderer, operation);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ impl Sandbox for Example {
|
|||
Position::Right => Position::FollowCursor,
|
||||
};
|
||||
|
||||
self.position = position
|
||||
self.position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ impl<'a> Step {
|
|||
is_showing_icon, ..
|
||||
} = self
|
||||
{
|
||||
*is_showing_icon = toggle
|
||||
*is_showing_icon = toggle;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ impl Builder {
|
|||
/// the starting point.
|
||||
#[inline]
|
||||
pub fn close(&mut self) {
|
||||
self.raw.close()
|
||||
self.raw.close();
|
||||
}
|
||||
|
||||
/// Builds the [`Path`] of this [`Builder`].
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ impl Linear {
|
|||
stops: impl IntoIterator<Item = ColorStop>,
|
||||
) -> Self {
|
||||
for stop in stops {
|
||||
self = self.add_stop(stop.offset, stop.color)
|
||||
self = self.add_stop(stop.offset, stop.color);
|
||||
}
|
||||
|
||||
self
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ impl Operation {
|
|||
use image::imageops;
|
||||
|
||||
if self.contains(Self::FLIP_DIAGONALLY) {
|
||||
imageops::flip_vertical_in_place(&mut image)
|
||||
imageops::flip_vertical_in_place(&mut image);
|
||||
}
|
||||
|
||||
if self.contains(Self::ROTATE_180) {
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ where
|
|||
}
|
||||
|
||||
fn draw(&mut self, handle: image::Handle, bounds: Rectangle) {
|
||||
self.primitives.push(Primitive::Image { handle, bounds })
|
||||
self.primitives.push(Primitive::Image { handle, bounds });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,6 +259,6 @@ where
|
|||
handle,
|
||||
color,
|
||||
bounds,
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ impl<T> Renderer<T> {
|
|||
pub fn draw_mesh(&mut self, mesh: Mesh) {
|
||||
match self {
|
||||
Self::TinySkia(_) => {
|
||||
log::warn!("Unsupported mesh primitive: {mesh:?}")
|
||||
log::warn!("Unsupported mesh primitive: {mesh:?}");
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
Self::Wgpu(renderer) => {
|
||||
|
|
@ -241,7 +241,7 @@ impl<T> crate::core::svg::Renderer for Renderer<T> {
|
|||
color: Option<crate::core::Color>,
|
||||
bounds: Rectangle,
|
||||
) {
|
||||
delegate!(self, renderer, renderer.draw(handle, color, bounds))
|
||||
delegate!(self, renderer, renderer.draw(handle, color, bounds));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
recurse(&mut self.overlay, layout, renderer, operation)
|
||||
recurse(&mut self.overlay, layout, renderer, operation);
|
||||
}
|
||||
|
||||
/// Processes a runtime [`Event`].
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ where
|
|||
match operation.finish() {
|
||||
operation::Outcome::None => {}
|
||||
operation::Outcome::Some(message) => {
|
||||
self.queued_messages.push(message)
|
||||
self.queued_messages.push(message);
|
||||
}
|
||||
operation::Outcome::Chain(next) => {
|
||||
current_operation = Some(next);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ impl<T: bytemuck::Pod> Buffer<T> {
|
|||
|
||||
/// Clears any temporary data (i.e. offsets) from the buffer.
|
||||
pub fn clear(&mut self) {
|
||||
self.offsets.clear()
|
||||
self.offsets.clear();
|
||||
}
|
||||
|
||||
/// Returns the offset at `index`, if it exists.
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ impl Frame {
|
|||
},
|
||||
size: self.size,
|
||||
}),
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
Buffer::Gradient(buffer) => {
|
||||
|
|
@ -493,7 +493,7 @@ impl Frame {
|
|||
},
|
||||
size: self.size,
|
||||
}),
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ impl Atlas {
|
|||
|
||||
padded_data[offset..offset + 4 * width as usize].copy_from_slice(
|
||||
&data[row * 4 * width as usize..(row + 1) * 4 * width as usize],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
match &entry {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ impl<'a> Layer<'a> {
|
|||
translation,
|
||||
primitive,
|
||||
current_layer,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Primitive::Clip { bounds, content } => {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ where
|
|||
child
|
||||
.as_widget()
|
||||
.operate(state, layout, renderer, operation);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ where
|
|||
y: bounds.y,
|
||||
..Rectangle::with_size(image_size)
|
||||
},
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ where
|
|||
child
|
||||
.as_widget()
|
||||
.operate(state, layout, renderer, operation);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>(
|
||||
|
|
|
|||
|
|
@ -240,9 +240,9 @@ where
|
|||
|tree, renderer, layout, element| {
|
||||
element.as_widget().draw(
|
||||
tree, renderer, theme, style, layout, cursor, viewport,
|
||||
)
|
||||
);
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fn mouse_interaction(
|
||||
|
|
|
|||
|
|
@ -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>(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ where
|
|||
controls_layout,
|
||||
renderer,
|
||||
operation,
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
if show_title {
|
||||
|
|
@ -295,7 +295,7 @@ where
|
|||
title_layout,
|
||||
renderer,
|
||||
operation,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ where
|
|||
&self.handle,
|
||||
&self.style,
|
||||
|| tree.state.downcast_ref::<State<Renderer::Paragraph>>(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fn overlay<'b>(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ where
|
|||
&self.range,
|
||||
theme,
|
||||
&self.style,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fn mouse_interaction(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ where
|
|||
&self.range,
|
||||
theme,
|
||||
&self.style,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fn mouse_interaction(
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ pub fn run_command<A, C, E>(
|
|||
size.width,
|
||||
size.height,
|
||||
)))
|
||||
.expect("Send message to event loop")
|
||||
.expect("Send message to event loop");
|
||||
}
|
||||
window::Action::Maximize(maximized) => {
|
||||
window.set_maximized(maximized);
|
||||
|
|
@ -784,7 +784,7 @@ pub fn run_command<A, C, E>(
|
|||
));
|
||||
}
|
||||
window::Action::ChangeIcon(icon) => {
|
||||
window.set_window_icon(conversion::icon(icon))
|
||||
window.set_window_icon(conversion::icon(icon));
|
||||
}
|
||||
window::Action::FetchMode(tag) => {
|
||||
let mode = if window.is_visible().unwrap_or(true) {
|
||||
|
|
@ -798,7 +798,7 @@ pub fn run_command<A, C, E>(
|
|||
.expect("Send message to event loop");
|
||||
}
|
||||
window::Action::ToggleMaximize => {
|
||||
window.set_maximized(!window.is_maximized())
|
||||
window.set_maximized(!window.is_maximized());
|
||||
}
|
||||
window::Action::ToggleDecorations => {
|
||||
window.set_decorations(!window.is_decorated());
|
||||
|
|
@ -833,7 +833,7 @@ pub fn run_command<A, C, E>(
|
|||
bytes,
|
||||
state.physical_size(),
|
||||
)))
|
||||
.expect("Send message to event loop.")
|
||||
.expect("Send message to event loop.");
|
||||
}
|
||||
},
|
||||
command::Action::System(action) => match action {
|
||||
|
|
@ -851,7 +851,7 @@ pub fn run_command<A, C, E>(
|
|||
|
||||
proxy
|
||||
.send_event(message)
|
||||
.expect("Send message to event loop")
|
||||
.expect("Send message to event loop");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl Clipboard {
|
|||
State::Connected(clipboard) => match clipboard.write(contents) {
|
||||
Ok(()) => {}
|
||||
Err(error) => {
|
||||
log::warn!("error writing to clipboard: {error}")
|
||||
log::warn!("error writing to clipboard: {error}");
|
||||
}
|
||||
},
|
||||
State::Unavailable => {}
|
||||
|
|
@ -58,6 +58,6 @@ impl crate::core::Clipboard for Clipboard {
|
|||
}
|
||||
|
||||
fn write(&mut self, contents: String) {
|
||||
self.write(contents)
|
||||
self.write(contents);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue