Skip to content

Commit 198892f

Browse files
committed
reformat
fix clippy suggestions
1 parent 7d0fef1 commit 198892f

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

druid/examples/viewport_header.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
// On Windows platform, don't show a console when opening the app.
1919
#![windows_subsystem = "windows"]
2020

21-
use druid::lens::Unit;
2221
use druid::widget::prelude::*;
2322
use druid::widget::{
24-
BackgroundBrush, Button, ClipBox, Controller, Flex, Label, List, Padding, Side, Slider, Tabs,
25-
TextBox, ViewportHeader,
23+
Button, Controller, Flex, Label, List, Side, TextBox, ViewportHeader,
2624
};
2725
use druid::{
28-
AppLauncher, Color, Data, Insets, Lens, LocalizedString, Point, Rect, RoundedRectRadii,
29-
Selector, Vec2, WidgetExt, WidgetPod, WindowDesc,
26+
AppLauncher, Color, Data, Insets, Lens, LocalizedString, RoundedRectRadii,
27+
Selector, WidgetExt, WindowDesc,
3028
};
3129
use im::Vector;
3230
use std::sync::Arc;

druid/src/widget/align.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<T> Align<T> {
9191
/// When the `Align` widget is fully visible, this option has no effect. When the align widget
9292
/// gets scrolled out of view, the wrapped widget will move to stay inside the visible area.
9393
/// The wrapped widget will always stay inside the bounds of the `Align` widget.
94-
fn in_viewport(mut self) -> Self {
94+
pub fn in_viewport(mut self) -> Self {
9595
self.in_viewport = true;
9696
self
9797
}
@@ -113,10 +113,10 @@ impl<T> Align<T> {
113113
// Essentially Rect::intersect but if the two rectangles dont intersect this
114114
// implementation chooses the point closed to viewpor inside extra_space to always give
115115
// the child a valid origin.
116-
extra_space.x0 = extra_space.x0.max(viewport.x0).min(extra_space.x1);
117-
extra_space.y0 = extra_space.y0.max(viewport.y0).min(extra_space.y1);
118-
extra_space.x1 = extra_space.x1.min(viewport.x1).max(extra_space.x0);
119-
extra_space.y1 = extra_space.y1.min(viewport.y1).max(extra_space.y0);
116+
extra_space.x0 = extra_space.x0.clamp(viewport.x0, extra_space.x1);
117+
extra_space.y0 = extra_space.y0.clamp(viewport.y0, extra_space.y1);
118+
extra_space.x1 = extra_space.x1.clamp(extra_space.x0, viewport.x1);
119+
extra_space.y1 = extra_space.y1.clamp(extra_space.y0, viewport.y1);
120120
}
121121

122122
let origin = self.align.resolve(extra_space).expand();

druid/src/widget/flex.rs

+6
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ pub enum Axis {
202202
/// This value is useful combination with an axis to indicate a side of a Rectangle.
203203
#[derive(Data, Debug, Clone, Copy, PartialEq, Eq)]
204204
pub enum Orientation {
205+
/// Start
205206
Start,
207+
/// End
206208
End,
207209
}
208210

@@ -219,9 +221,13 @@ impl Orientation {
219221
/// Represents one of the sides of a Rectangle.
220222
#[derive(Data, Debug, Clone, Copy, PartialEq, Eq)]
221223
pub enum Side {
224+
/// The top side of a rectangle (y0).
222225
Top,
226+
/// The left side of a rectangle (x0).
223227
Left,
228+
/// The right side of a rectangle (x1).
224229
Right,
230+
/// The bottom side of a rectangle (y1).
225231
Bottom,
226232
}
227233

druid/src/widget/viewport_header.rs

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ impl ViewportHeaderConfig {
4545
}
4646
}
4747

48+
/// The minimum visible content constrained by the the actual size of the content on that
49+
/// axis.
4850
pub fn minimum_visible(&self) -> f64 {
4951
self.minimum_visible_content
5052
.min(self.header_side.axis().major(self.content_size))

0 commit comments

Comments
 (0)