Add #[must_use] to all widget builders
This commit is contained in:
parent
90797f04f4
commit
08a4179e7e
4 changed files with 4 additions and 0 deletions
|
@ -136,6 +136,7 @@ impl Widget for Button {
|
||||||
|
|
||||||
// TODO: allow checkbox without a text label
|
// TODO: allow checkbox without a text label
|
||||||
/// Boolean on/off control with text label.
|
/// Boolean on/off control with text label.
|
||||||
|
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Checkbox<'a> {
|
pub struct Checkbox<'a> {
|
||||||
checked: &'a mut bool,
|
checked: &'a mut bool,
|
||||||
|
|
|
@ -17,6 +17,7 @@ fn set(value_function: &mut GetSetValue<'_>, value: f64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A numeric value that you can change by dragging the number. More compact than a [`Slider`].
|
/// A numeric value that you can change by dragging the number. More compact than a [`Slider`].
|
||||||
|
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
|
||||||
pub struct DragValue<'a> {
|
pub struct DragValue<'a> {
|
||||||
value_function: GetSetValue<'a>,
|
value_function: GetSetValue<'a>,
|
||||||
speed: f32,
|
speed: f32,
|
||||||
|
|
|
@ -37,6 +37,7 @@ struct SliderSpec {
|
||||||
|
|
||||||
/// Control a number by a horizontal slider.
|
/// Control a number by a horizontal slider.
|
||||||
/// The range can include any numbers, and go from low-to-high or from high-to-low.
|
/// The range can include any numbers, and go from low-to-high or from high-to-low.
|
||||||
|
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
|
||||||
pub struct Slider<'a> {
|
pub struct Slider<'a> {
|
||||||
get_set_value: GetSetValue<'a>,
|
get_set_value: GetSetValue<'a>,
|
||||||
range: RangeInclusive<f64>,
|
range: RangeInclusive<f64>,
|
||||||
|
|
|
@ -119,6 +119,7 @@ impl CCursorPair {
|
||||||
/// // use my_string
|
/// // use my_string
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct TextEdit<'t> {
|
pub struct TextEdit<'t> {
|
||||||
text: &'t mut String,
|
text: &'t mut String,
|
||||||
|
|
Loading…
Reference in a new issue