@@ -47,22 +47,22 @@ impl Checkbox {
4747// --- MARK: WIDGETMUT ---
4848impl Checkbox {
4949 /// Check or uncheck the box.
50- pub fn set_checked ( this : & mut WidgetMut < ' _ , Self > , checked : bool ) {
51- this . widget . checked = checked;
50+ pub fn set_checked ( self : & mut WidgetMut < ' _ , Self > , checked : bool ) {
51+ self . widget . checked = checked;
5252 // Checked state impacts appearance and accessibility node
53- this . ctx . request_render ( ) ;
53+ self . ctx . request_render ( ) ;
5454 }
5555
5656 /// Set the text.
5757 ///
5858 /// We enforce this to be an `ArcStr` to make the allocation explicit.
59- pub fn set_text ( this : & mut WidgetMut < ' _ , Self > , new_text : ArcStr ) {
60- Label :: set_text ( & mut Self :: label_mut ( this ) , new_text) ;
59+ pub fn set_text ( self : & mut WidgetMut < ' _ , Self > , new_text : ArcStr ) {
60+ Label :: set_text ( & mut self . label_mut ( ) , new_text) ;
6161 }
6262
6363 /// Get a mutable reference to the label.
64- pub fn label_mut < ' t > ( this : & ' t mut WidgetMut < ' _ , Self > ) -> WidgetMut < ' t , Label > {
65- this . ctx . get_mut ( & mut this . widget . label )
64+ pub fn label_mut < ' t > ( self : & ' t mut WidgetMut < ' _ , Self > ) -> WidgetMut < ' t , Label > {
65+ self . ctx . get_mut ( & mut self . widget . label )
6666 }
6767}
6868
@@ -312,15 +312,12 @@ mod tests {
312312
313313 harness. edit_root_widget ( |mut checkbox| {
314314 let mut checkbox = checkbox. downcast :: < Checkbox > ( ) ;
315- Checkbox :: set_checked ( & mut checkbox, true ) ;
316- Checkbox :: set_text (
317- & mut checkbox,
318- ArcStr :: from ( "The quick brown fox jumps over the lazy dog" ) ,
319- ) ;
320-
321- let mut label = Checkbox :: label_mut ( & mut checkbox) ;
322- Label :: set_brush ( & mut label, PRIMARY_LIGHT ) ;
323- Label :: insert_style ( & mut label, StyleProperty :: FontSize ( 20.0 ) ) ;
315+ checkbox. set_checked ( true ) ;
316+ checkbox. set_text ( "The quick brown fox jumps over the lazy dog" . into ( ) ) ;
317+
318+ let mut label = checkbox. label_mut ( ) ;
319+ label. set_brush ( PRIMARY_LIGHT ) ;
320+ label. insert_style ( StyleProperty :: FontSize ( 20.0 ) ) ;
324321 } ) ;
325322
326323 harness. render ( )
0 commit comments