File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ macro_rules! _assert_snapshot_base {
347347 $crate:: _macro_support:: assert_snapshot(
348348 $name. into( ) ,
349349 #[ allow( clippy:: redundant_closure_call) ]
350- & $transform( $value) ,
350+ & $transform( & $value) ,
351351 env!( "CARGO_MANIFEST_DIR" ) ,
352352 $crate:: _function_name!( ) ,
353353 module_path!( ) ,
Original file line number Diff line number Diff line change @@ -917,3 +917,13 @@ fn test_parse_yaml_error() {
917917 assert ! ( error. contains( "Failed parsing the YAML from" ) ) ;
918918 assert ! ( error. contains( "/bad.yaml" ) ) ;
919919}
920+
921+ /// Check that snapshots don't take ownership of the value
922+ #[ test]
923+ fn test_ownership ( ) {
924+ // Range is non-copy
925+ use std:: ops:: Range ;
926+ let r = Range { start : 0 , end : 10 } ;
927+ assert_debug_snapshot ! ( r, @"0..10" ) ;
928+ assert_debug_snapshot ! ( r, @"0..10" ) ;
929+ }
You can’t perform that action at this time.
0 commit comments