Skip to content

Commit 94b6ccd

Browse files
committed
leak string without box::leak
1 parent 99aae0e commit 94b6ccd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/backend/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,10 @@ fn style_to_font<S: BackendTextStyle>(style: &S) -> Font {
316316
|_| font::Family::default(),
317317
|mut vec_guard| {
318318
if !vec_guard.contains(s) {
319-
let leaked_str = &Box::leak(Box::new(String::from(s)))[..];
320-
vec_guard.insert(&leaked_str);
319+
vec_guard.insert(String::from(s).leak());
321320
}
322321

323-
font::Family::Name(vec_guard.get(s).unwrap())
322+
font::Family::Name(*vec_guard.get(s).unwrap())
324323
},
325324
),
326325
},

0 commit comments

Comments
 (0)