@@ -20,8 +20,9 @@ const _: () = {
2020 use std:: alloc:: Layout ;
2121 let std_layout = Layout :: new :: < std:: os:: windows:: io:: RawHandle > ( ) ;
2222 let winapi_layout = Layout :: new :: < winapi:: um:: winnt:: HANDLE > ( ) ;
23- assert ! ( std_layout. size( ) == winapi_layout. size( ) ) ;
24- assert ! ( std_layout. align( ) == winapi_layout. align( ) ) ;
23+ // MSVR(Rust v1.57): use assert! instead
24+ [ ( ) ; 1 ] [ !( std_layout. size ( ) == winapi_layout. size ( ) ) as usize ] ;
25+ [ ( ) ; 1 ] [ !( std_layout. align ( ) == winapi_layout. align ( ) ) as usize ] ;
2526} ;
2627
2728/// This prefix indicates to NTFS that the path is to be treated as a non-interpreted
@@ -141,14 +142,12 @@ pub fn get_target(junction: &Path) -> io::Result<PathBuf> {
141142 if rdb. reparse_tag == IO_REPARSE_TAG_MOUNT_POINT {
142143 let offset = rdb. reparse_buffer . substitute_name_offset / WCHAR_SIZE ;
143144 let len = rdb. reparse_buffer . substitute_name_length / WCHAR_SIZE ;
144- let mut wide = unsafe {
145+ let wide = unsafe {
145146 let buf = rdb. reparse_buffer . path_buffer . as_ptr ( ) . add ( offset as usize ) ;
146147 slice:: from_raw_parts ( buf, len as usize )
147148 } ;
148149 // In case of "\??\C:\foo\bar"
149- if wide. starts_with ( & NON_INTERPRETED_PATH_PREFIX ) {
150- wide = & wide[ ( NON_INTERPRETED_PATH_PREFIX . len ( ) ) ..] ;
151- }
150+ let wide = wide. strip_prefix ( & NON_INTERPRETED_PATH_PREFIX ) . unwrap_or ( wide) ;
152151 Ok ( PathBuf :: from ( OsString :: from_wide ( wide) ) )
153152 } else {
154153 Err ( io:: Error :: new ( io:: ErrorKind :: Other , "not a reparse tag mount point" ) )
0 commit comments