mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 05:14:24 +00:00
craft-ui-widgets: lints the gate denies (redundant must_use on builder setters, a Paint alias for the picture's painter, the test rows' type, the removed veil named)
This commit is contained in:
@@ -26,7 +26,6 @@ impl<'a> BarHome<'a> {
|
||||
}
|
||||
|
||||
/// Whether the button takes input; it is enabled by default.
|
||||
#[must_use]
|
||||
pub fn enabled(mut self, on: bool) -> Self {
|
||||
self.enabled = on;
|
||||
self
|
||||
@@ -74,7 +73,6 @@ impl BarTool {
|
||||
}
|
||||
|
||||
/// Whether the icon takes input; it is enabled by default. The arrow draws in the disabled look with it.
|
||||
#[must_use]
|
||||
pub fn enabled(mut self, on: bool) -> Self {
|
||||
self.enabled = on;
|
||||
self
|
||||
|
||||
@@ -36,12 +36,15 @@ pub struct PictureStyle {
|
||||
height: f32,
|
||||
}
|
||||
|
||||
/// A content painter that paints into the picture's rect.
|
||||
type Paint<'a> = Box<dyn Fn(&ContentPainterCx, Rect) + 'a>;
|
||||
|
||||
/// Where a picture's content comes from.
|
||||
enum Source<'a> {
|
||||
/// Pixels the caller makes, stored as a texture under `key`.
|
||||
Image { key: u64, image: &'a dyn Fn() -> ColorImage },
|
||||
/// A content painter that paints into the picture's rect.
|
||||
Painter(Box<dyn Fn(&ContentPainterCx, Rect) + 'a>),
|
||||
Painter(Paint<'a>),
|
||||
}
|
||||
|
||||
/// A picture of an image the caller makes (`new`) or of what a content painter paints (`painter`); both sit in a rect
|
||||
|
||||
@@ -196,14 +196,12 @@ impl<'a, D: Clone + Eq + Hash + Send + Sync + std::fmt::Debug + 'static> Documen
|
||||
}
|
||||
|
||||
/// Every tab takes the strip's taller form.
|
||||
#[must_use]
|
||||
pub fn large(mut self, on: bool) -> Self {
|
||||
self.large = on;
|
||||
self
|
||||
}
|
||||
|
||||
/// The strip takes files dragged from the operating system and reports them as `FilesDropped`.
|
||||
#[must_use]
|
||||
pub fn takes_files(mut self, on: bool) -> Self {
|
||||
self.takes_files = on;
|
||||
self
|
||||
|
||||
@@ -108,7 +108,7 @@ fn a_disabled_faded_component_paints_its_enabled_look_faded_once() {
|
||||
"the veil is painted after the tile's last shape"
|
||||
);
|
||||
let mut own = disabled.clone();
|
||||
own.remove(veil);
|
||||
let _veil = own.remove(veil);
|
||||
let (own, enabled) = (colors(&own), colors(&enabled));
|
||||
assert_eq!(own, enabled, "under the veil the disabled tile paints its enabled colours");
|
||||
let painting = own.iter().filter(|shape| shape.iter().any(|color| color.a() > 0)).count();
|
||||
|
||||
@@ -172,7 +172,8 @@ fn close(a: f64, b: f64) -> bool {
|
||||
#[trial]
|
||||
fn the_zoom_field_reads_ratios_and_one_separator_and_refuses_the_rest() {
|
||||
use Input::{Pasted, Typed};
|
||||
let rows: [(bool, Input, Option<&str>, f64, bool, bool); 10] = [
|
||||
type Row = (bool, Input, Option<&'static str>, f64, bool, bool);
|
||||
let rows: [Row; 10] = [
|
||||
(false, Typed("045"), Some("45"), 45.0, false, false),
|
||||
(false, Typed("1/2"), Some("50"), 50.0, false, false),
|
||||
(false, Pasted("5/2"), Some("250"), 250.0, false, false),
|
||||
|
||||
Reference in New Issue
Block a user