File tree 3 files changed +17
-8
lines changed 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change
1
+ use std:: fmt;
1
2
use std:: sync:: RwLock ;
2
3
use std:: collections:: HashSet ;
3
4
use std:: slice;
@@ -51,6 +52,13 @@ impl Deref for InternedString {
51
52
}
52
53
}
53
54
55
+ impl fmt:: Debug for InternedString {
56
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
57
+ let str: & str = & * self ;
58
+ write ! ( f, "InternedString {{ {} }}" , str )
59
+ }
60
+ }
61
+
54
62
impl Ord for InternedString {
55
63
fn cmp ( & self , other : & InternedString ) -> Ordering {
56
64
let str: & str = & * self ;
Original file line number Diff line number Diff line change @@ -734,11 +734,11 @@ impl RemainingCandidates {
734
734
use std:: mem:: replace;
735
735
for ( _, b) in self . remaining . by_ref ( ) {
736
736
if let Some ( link) = b. summary . links ( ) {
737
- if let Some ( a) = links. get ( & InternedString :: new ( link) ) {
737
+ if let Some ( a) = links. get ( & link) {
738
738
if a != b. summary . package_id ( ) {
739
739
self . conflicting_prev_active
740
740
. entry ( a. clone ( ) )
741
- . or_insert_with ( || ConflictReason :: Links ( link. to_owned ( ) ) ) ;
741
+ . or_insert_with ( || ConflictReason :: Links ( link. to_string ( ) ) ) ;
742
742
continue ;
743
743
}
744
744
}
@@ -1309,9 +1309,9 @@ impl Context {
1309
1309
if !prev. iter ( ) . any ( |c| c == summary) {
1310
1310
self . resolve_graph . push ( GraphNode :: Add ( id. clone ( ) ) ) ;
1311
1311
if let Some ( link) = summary. links ( ) {
1312
- ensure ! ( self . links. insert( InternedString :: new ( link) , id. clone( ) ) . is_none( ) ,
1312
+ ensure ! ( self . links. insert( link, id. clone( ) ) . is_none( ) ,
1313
1313
"Attempting to resolve a with more then one crate with the links={}. \n \
1314
- This will not build as is. Consider rebuilding the .lock file.", link) ;
1314
+ This will not build as is. Consider rebuilding the .lock file.", & * link) ;
1315
1315
}
1316
1316
let mut inner: Vec < _ > = ( * * prev) . clone ( ) ;
1317
1317
inner. push ( summary. clone ( ) ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use std::rc::Rc;
4
4
5
5
use semver:: Version ;
6
6
use core:: { Dependency , PackageId , SourceId } ;
7
+ use core:: interning:: InternedString ;
7
8
8
9
use util:: CargoResult ;
9
10
@@ -22,7 +23,7 @@ struct Inner {
22
23
dependencies : Vec < Dependency > ,
23
24
features : BTreeMap < String , Vec < String > > ,
24
25
checksum : Option < String > ,
25
- links : Option < String > ,
26
+ links : Option < InternedString > ,
26
27
}
27
28
28
29
impl Summary {
@@ -71,7 +72,7 @@ impl Summary {
71
72
dependencies,
72
73
features,
73
74
checksum : None ,
74
- links,
75
+ links : links . map ( |l| InternedString :: new ( & l ) ) ,
75
76
} ) ,
76
77
} )
77
78
}
@@ -85,8 +86,8 @@ impl Summary {
85
86
pub fn checksum ( & self ) -> Option < & str > {
86
87
self . inner . checksum . as_ref ( ) . map ( |s| & s[ ..] )
87
88
}
88
- pub fn links ( & self ) -> Option < & str > {
89
- self . inner . links . as_ref ( ) . map ( |s| & s [ .. ] )
89
+ pub fn links ( & self ) -> Option < InternedString > {
90
+ self . inner . links
90
91
}
91
92
92
93
pub fn override_id ( mut self , id : PackageId ) -> Summary {
You can’t perform that action at this time.
0 commit comments