File tree Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ impl DistString for Standard {
97
97
// A char is encoded with at most four bytes, thus this reservation is
98
98
// guaranteed to be sufficient. We do not shrink_to_fit afterwards so
99
99
// that repeated usage on the same `String` buffer does not reallocate.
100
- s. reserve ( s . len ( ) + 4 * len) ;
100
+ s. reserve ( 4 * len) ;
101
101
s. extend ( Distribution :: < char > :: sample_iter ( self , rng) . take ( len) ) ;
102
102
}
103
103
}
@@ -126,7 +126,6 @@ impl DistString for Alphanumeric {
126
126
fn append_string < R : Rng + ?Sized > ( & self , rng : & mut R , string : & mut String , len : usize ) {
127
127
unsafe {
128
128
let v = string. as_mut_vec ( ) ;
129
- v. reserve ( v. len ( ) + len) ;
130
129
v. extend ( self . sample_iter ( rng) . take ( len) ) ;
131
130
}
132
131
}
You can’t perform that action at this time.
0 commit comments