File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ impl<T> CachedValue<T> {
30
30
31
31
impl < T > CachedValue < T >
32
32
where
33
- T : std:: fmt:: Debug ,
33
+ T : std:: fmt:: Debug + std :: clone :: Clone ,
34
34
{
35
- pub fn unwrap ( self ) -> T {
36
- Arc :: try_unwrap ( self . 0 ) . unwrap ( )
35
+ #[ inline]
36
+ pub fn clone_inner ( self ) -> T {
37
+ Arc :: unwrap_or_clone ( self . 0 )
37
38
}
38
39
}
39
40
@@ -50,7 +51,7 @@ impl<T> VirolutionCache<T> {
50
51
51
52
pub fn cache_get ( & self , key : & usize ) -> Option < CachedValue < T > > {
52
53
let mut cache = self . cache . lock ( ) . unwrap ( ) ;
53
- cache. cache_get ( & key) . cloned ( )
54
+ cache. cache_get ( key) . cloned ( )
54
55
}
55
56
56
57
pub fn cache_set ( & self , key : usize , value : T ) -> CachedValue < T > {
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ impl Haplotype {
353
353
format ! (
354
354
";{position}:{}->{}" ,
355
355
char :: from( STRICT_ENCODE [ & f] ) ,
356
- char :: from( STRICT_ENCODE [ & t] )
356
+ char :: from( STRICT_ENCODE [ t] )
357
357
)
358
358
. as_str ( ) ,
359
359
) ;
@@ -364,7 +364,7 @@ impl Haplotype {
364
364
format ! (
365
365
";{position}:{}->{}" ,
366
366
char :: from( STRICT_ENCODE [ & wt_symbol] ) ,
367
- char :: from( STRICT_ENCODE [ & t] )
367
+ char :: from( STRICT_ENCODE [ t] )
368
368
)
369
369
. as_str ( ) ,
370
370
)
@@ -678,7 +678,7 @@ impl Mutant {
678
678
}
679
679
680
680
pub fn get_mutations ( & self ) -> CachedValue < HashMap < usize , Symbol > > {
681
- let mut mutations = self . ancestor . get_mutations ( ) . unwrap ( ) . clone ( ) ;
681
+ let mut mutations = self . ancestor . get_mutations ( ) . clone_inner ( ) ;
682
682
683
683
let wt_ref = self . wildtype . upgrade ( ) . unwrap ( ) ;
684
684
You can’t perform that action at this time.
0 commit comments