File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,11 @@ impl<T: Source + Hash + PartialEq + Eq + 'static> Source for CachedSource<T> {
104
104
// This is based on the following assumptions:
105
105
// 1. `SourceMap` will be valid for the entire duration of the application.
106
106
// 2. The cached `SourceMap` will not be manually removed or replaced, ensuring the reference's safety.
107
- let map = unsafe { std:: mem:: transmute :: < & SourceMap , & ' static SourceMap > ( map) } ;
107
+ let map = unsafe {
108
+ std:: mem:: transmute :: < & SourceMap , & ' static SourceMap > ( map)
109
+ } ;
108
110
Some ( Cow :: Borrowed ( map) )
109
- } ,
111
+ }
110
112
None => None ,
111
113
}
112
114
} else {
@@ -122,9 +124,11 @@ impl<T: Source + Hash + PartialEq + Eq + 'static> Source for CachedSource<T> {
122
124
// This is based on the following assumptions:
123
125
// 1. `SourceMap` will be valid for the entire duration of the application.
124
126
// 2. The cached `SourceMap` will not be manually removed or replaced, ensuring the reference's safety.
125
- let map = unsafe { std:: mem:: transmute :: < & SourceMap , & ' static SourceMap > ( map) } ;
127
+ let map = unsafe {
128
+ std:: mem:: transmute :: < & SourceMap , & ' static SourceMap > ( map)
129
+ } ;
126
130
Some ( Cow :: Borrowed ( map) )
127
- } ,
131
+ }
128
132
None => None ,
129
133
}
130
134
}
Original file line number Diff line number Diff line change @@ -427,11 +427,15 @@ mod tests {
427
427
}
428
428
429
429
test_cached ! ( source, |s: & dyn Source | s. source( ) . to_string( ) ) ;
430
- test_cached ! ( source, |s: & dyn Source | s. map( & MapOptions :: default ( ) ) . map( |m| m. into_owned( ) ) ) ;
431
- test_cached ! ( source, |s: & dyn Source | s. map( & MapOptions {
432
- columns: false ,
433
- final_source: true
434
- } ) . map( |m| m. into_owned( ) ) ) ;
430
+ test_cached ! ( source, |s: & dyn Source | s
431
+ . map( & MapOptions :: default ( ) )
432
+ . map( |m| m. into_owned( ) ) ) ;
433
+ test_cached ! ( source, |s: & dyn Source | s
434
+ . map( & MapOptions {
435
+ columns: false ,
436
+ final_source: true
437
+ } )
438
+ . map( |m| m. into_owned( ) ) ) ;
435
439
}
436
440
437
441
#[ test]
@@ -611,9 +615,8 @@ mod tests {
611
615
}"# ,
612
616
)
613
617
. unwrap ( ) ;
614
- let inner_source_map = inner_source
615
- . map ( & MapOptions :: default ( ) )
616
- . map ( |map| {
618
+ let inner_source_map =
619
+ inner_source. map ( & MapOptions :: default ( ) ) . map ( |map| {
617
620
let mut map = map. into_owned ( ) ;
618
621
map. set_source_root ( Some ( "/path/to/folder/" . to_string ( ) ) ) ;
619
622
map
You can’t perform that action at this time.
0 commit comments