@@ -179,18 +179,14 @@ impl From<*mut ffi::ada_url> for Url {
179
179
}
180
180
}
181
181
182
- #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Default , Display ) ]
183
- #[ cfg_attr( feature = "std" , derive( derive_more:: Error ) ) ] // error still requires std: https://github.com/rust-lang/rust/issues/103765
184
- pub struct SetterError ;
185
-
186
- type SetterResult = Result < ( ) , SetterError > ;
182
+ type SetterResult = Result < ( ) , ( ) > ;
187
183
188
184
#[ inline]
189
185
const fn setter_result ( successful : bool ) -> SetterResult {
190
186
if successful {
191
187
Ok ( ( ) )
192
188
} else {
193
- Err ( SetterError )
189
+ Err ( ( ) )
194
190
}
195
191
}
196
192
@@ -299,6 +295,7 @@ impl Url {
299
295
/// url.set_href("https://lemire.me").unwrap();
300
296
/// assert_eq!(url.href(), "https://lemire.me/");
301
297
/// ```
298
+ #[ allow( clippy:: result_unit_err) ]
302
299
pub fn set_href ( & mut self , input : & str ) -> SetterResult {
303
300
setter_result ( unsafe { ffi:: ada_set_href ( self . 0 , input. as_ptr ( ) . cast ( ) , input. len ( ) ) } )
304
301
}
@@ -327,6 +324,7 @@ impl Url {
327
324
/// url.set_username(Some("username")).unwrap();
328
325
/// assert_eq!(url.href(), "https://[email protected] /");
329
326
/// ```
327
+ #[ allow( clippy:: result_unit_err) ]
330
328
pub fn set_username ( & mut self , input : Option < & str > ) -> SetterResult {
331
329
setter_result ( unsafe {
332
330
ffi:: ada_set_username (
@@ -361,6 +359,7 @@ impl Url {
361
359
/// url.set_password(Some("password")).unwrap();
362
360
/// assert_eq!(url.href(), "https://:[email protected] /");
363
361
/// ```
362
+ #[ allow( clippy:: result_unit_err) ]
364
363
pub fn set_password ( & mut self , input : Option < & str > ) -> SetterResult {
365
364
setter_result ( unsafe {
366
365
ffi:: ada_set_password (
@@ -398,6 +397,7 @@ impl Url {
398
397
/// url.set_port(Some("8080")).unwrap();
399
398
/// assert_eq!(url.href(), "https://yagiz.co:8080/");
400
399
/// ```
400
+ #[ allow( clippy:: result_unit_err) ]
401
401
pub fn set_port ( & mut self , input : Option < & str > ) -> SetterResult {
402
402
if let Some ( value) = input {
403
403
setter_result ( unsafe { ffi:: ada_set_port ( self . 0 , value. as_ptr ( ) . cast ( ) , value. len ( ) ) } )
@@ -469,6 +469,7 @@ impl Url {
469
469
/// url.set_host(Some("localhost:3000")).unwrap();
470
470
/// assert_eq!(url.href(), "https://localhost:3000/");
471
471
/// ```
472
+ #[ allow( clippy:: result_unit_err) ]
472
473
pub fn set_host ( & mut self , input : Option < & str > ) -> SetterResult {
473
474
setter_result ( unsafe {
474
475
ffi:: ada_set_host (
@@ -507,6 +508,7 @@ impl Url {
507
508
/// url.set_hostname(Some("localhost")).unwrap();
508
509
/// assert_eq!(url.href(), "https://localhost/");
509
510
/// ```
511
+ #[ allow( clippy:: result_unit_err) ]
510
512
pub fn set_hostname ( & mut self , input : Option < & str > ) -> SetterResult {
511
513
setter_result ( unsafe {
512
514
ffi:: ada_set_hostname (
@@ -541,6 +543,7 @@ impl Url {
541
543
/// url.set_pathname(Some("/contact")).unwrap();
542
544
/// assert_eq!(url.href(), "https://yagiz.co/contact");
543
545
/// ```
546
+ #[ allow( clippy:: result_unit_err) ]
544
547
pub fn set_pathname ( & mut self , input : Option < & str > ) -> SetterResult {
545
548
setter_result ( unsafe {
546
549
ffi:: ada_set_pathname (
@@ -611,6 +614,7 @@ impl Url {
611
614
/// url.set_protocol("http").unwrap();
612
615
/// assert_eq!(url.href(), "http://yagiz.co/");
613
616
/// ```
617
+ #[ allow( clippy:: result_unit_err) ]
614
618
pub fn set_protocol ( & mut self , input : & str ) -> SetterResult {
615
619
setter_result ( unsafe { ffi:: ada_set_protocol ( self . 0 , input. as_ptr ( ) . cast ( ) , input. len ( ) ) } )
616
620
}
0 commit comments