@@ -127,6 +127,7 @@ pub use lifetime_free::LifetimeFree;
127
127
/// Specialization in a blanket trait implementation:
128
128
///
129
129
/// ```
130
+ /// # #[cfg(feature = "std")] {
130
131
/// use std::fmt::Display;
131
132
/// use castaway::cast;
132
133
///
@@ -160,6 +161,7 @@ pub use lifetime_free::LifetimeFree;
160
161
///
161
162
/// println!("specialized: {}", String::from("hello").fast_to_string());
162
163
/// println!("default: {}", "hello".fast_to_string());
164
+ /// # }
163
165
/// ```
164
166
#[ macro_export]
165
167
macro_rules! cast {
@@ -311,6 +313,7 @@ mod tests {
311
313
312
314
inner2 ( & slice) ;
313
315
316
+ #[ allow( clippy:: needless_lifetimes) ]
314
317
fn inner3 < ' a > ( value : & ' a mut [ u8 ] ) {
315
318
assert_eq ! ( cast!( value, & mut [ u8 ] ) , Ok ( & mut [ 1 , 1 ] [ ..] ) ) ;
316
319
}
@@ -341,6 +344,7 @@ mod tests {
341
344
( ) => { } ;
342
345
343
346
(
347
+ $( #[ $meta: meta] ) *
344
348
for $TARGET: ty as $name: ident {
345
349
$(
346
350
$value: expr => $matches: pat $( if $guard: expr) ?,
@@ -349,6 +353,7 @@ mod tests {
349
353
$( $tail: tt) *
350
354
) => {
351
355
paste:: paste! {
356
+ $( #[ $meta] ) *
352
357
#[ test]
353
358
#[ allow( non_snake_case) ]
354
359
fn [ <cast_lifetime_free_ $name>] ( ) {
@@ -364,6 +369,7 @@ mod tests {
364
369
) *
365
370
}
366
371
372
+ $( #[ $meta] ) *
367
373
#[ test]
368
374
#[ allow( non_snake_case) ]
369
375
fn [ <cast_lifetime_free_ref_ $name>] ( ) {
@@ -379,6 +385,7 @@ mod tests {
379
385
) *
380
386
}
381
387
388
+ $( #[ $meta] ) *
382
389
#[ test]
383
390
#[ allow( non_snake_case) ]
384
391
fn [ <cast_lifetime_free_mut_ $name>] ( ) {
@@ -401,6 +408,7 @@ mod tests {
401
408
} ;
402
409
403
410
(
411
+ $( #[ $meta: meta] ) *
404
412
for $TARGET: ty {
405
413
$(
406
414
$value: expr => $matches: pat $( if $guard: expr) ?,
@@ -409,6 +417,7 @@ mod tests {
409
417
$( $tail: tt) *
410
418
) => {
411
419
paste:: paste! {
420
+ $( #[ $meta] ) *
412
421
#[ test]
413
422
#[ allow( non_snake_case) ]
414
423
fn [ <cast_lifetime_free_ $TARGET>] ( ) {
@@ -424,6 +433,7 @@ mod tests {
424
433
) *
425
434
}
426
435
436
+ $( #[ $meta] ) *
427
437
#[ test]
428
438
#[ allow( non_snake_case) ]
429
439
fn [ <cast_lifetime_free_ref_ $TARGET>] ( ) {
@@ -439,6 +449,7 @@ mod tests {
439
449
) *
440
450
}
441
451
452
+ $( #[ $meta] ) *
442
453
#[ test]
443
454
#[ allow( non_snake_case) ]
444
455
fn [ <cast_lifetime_free_mut_ $TARGET>] ( ) {
@@ -478,6 +489,7 @@ mod tests {
478
489
3.2f64 => Err ( v) if v == 3.2f64 ,
479
490
}
480
491
492
+ #[ cfg( feature = "std" ) ]
481
493
for String {
482
494
String :: from( "hello world" ) => Ok ( ref v) if v. as_str( ) == "hello world" ,
483
495
"hello world" => Err ( "hello world" ) ,
0 commit comments