File tree Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -326,8 +326,8 @@ impl<'a> Node<'a> {
326
326
self . data ( ) . role ( )
327
327
}
328
328
329
- pub fn role_description ( & self ) -> Option < String > {
330
- self . data ( ) . role_description ( ) . map ( String :: from )
329
+ pub fn role_description ( & self ) -> Option < & str > {
330
+ self . data ( ) . role_description ( )
331
331
}
332
332
333
333
pub fn has_role_description ( & self ) -> bool {
@@ -524,10 +524,8 @@ impl<'a> Node<'a> {
524
524
. map ( |description| description. to_string ( ) )
525
525
}
526
526
527
- pub fn placeholder ( & self ) -> Option < String > {
528
- self . data ( )
529
- . placeholder ( )
530
- . map ( |placeholder| placeholder. to_string ( ) )
527
+ pub fn placeholder ( & self ) -> Option < & str > {
528
+ self . data ( ) . placeholder ( )
531
529
}
532
530
533
531
pub fn value ( & self ) -> Option < String > {
Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ impl NodeWrapper<'_> {
355
355
fn attributes ( & self ) -> HashMap < & ' static str , String > {
356
356
let mut attributes = HashMap :: new ( ) ;
357
357
if let Some ( placeholder) = self . 0 . placeholder ( ) {
358
- attributes. insert ( "placeholder-text" , placeholder) ;
358
+ attributes. insert ( "placeholder-text" , placeholder. to_string ( ) ) ;
359
359
}
360
360
attributes
361
361
}
@@ -775,7 +775,7 @@ impl PlatformNode {
775
775
}
776
776
777
777
pub fn localized_role_name ( & self ) -> Result < String > {
778
- self . resolve ( |node| Ok ( node. role_description ( ) . unwrap_or_default ( ) ) )
778
+ self . resolve ( |node| Ok ( node. role_description ( ) . unwrap_or_default ( ) . to_string ( ) ) )
779
779
}
780
780
781
781
pub fn state ( & self ) -> StateSet {
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ impl NodeWrapper<'_> {
316
316
self . 0 . description ( )
317
317
}
318
318
319
- pub ( crate ) fn placeholder ( & self ) -> Option < String > {
319
+ pub ( crate ) fn placeholder ( & self ) -> Option < & str > {
320
320
self . 0 . placeholder ( )
321
321
}
322
322
@@ -452,7 +452,7 @@ declare_class!(
452
452
fn role_description( & self ) -> Option <Id <NSString >> {
453
453
self . resolve( |node| {
454
454
if let Some ( role_description) = node. role_description( ) {
455
- Some ( NSString :: from_str( & role_description) )
455
+ Some ( NSString :: from_str( role_description) )
456
456
} else {
457
457
unsafe { msg_send_id![ super ( self ) , accessibilityRoleDescription] }
458
458
}
@@ -490,7 +490,7 @@ declare_class!(
490
490
fn placeholder( & self ) -> Option <Id <NSString >> {
491
491
self . resolve( |node| {
492
492
let wrapper = NodeWrapper ( node) ;
493
- wrapper. placeholder( ) . map( |placeholder| NSString :: from_str( & placeholder ) )
493
+ wrapper. placeholder( ) . map( NSString :: from_str)
494
494
} )
495
495
. flatten( )
496
496
}
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ impl NodeWrapper<'_> {
254
254
}
255
255
}
256
256
257
- fn localized_control_type ( & self ) -> Option < String > {
257
+ fn localized_control_type ( & self ) -> Option < & str > {
258
258
self . 0 . role_description ( )
259
259
}
260
260
@@ -270,7 +270,7 @@ impl NodeWrapper<'_> {
270
270
self . 0 . description ( )
271
271
}
272
272
273
- fn placeholder ( & self ) -> Option < String > {
273
+ fn placeholder ( & self ) -> Option < & str > {
274
274
self . 0 . placeholder ( )
275
275
}
276
276
You can’t perform that action at this time.
0 commit comments