Skip to content

Commit 7053d0a

Browse files
authored
refactor(utils): refactor borrowed str leak (#12)
1 parent e5ebd96 commit 7053d0a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.changeset/grumpy-panthers-punch.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ pub(crate) fn leak_borrowed_str_or_default(s: Option<&String>, default: &str) ->
1212
s.map_or_else(|| leak_str(default.to_string()), |s| leak_str(s.clone()))
1313
}
1414

15-
pub(crate) fn leak_borrowed_str(s: impl Into<String>) -> &'static str {
16-
Into::<String>::into(s).leak()
15+
pub(crate) fn leak_borrowed_str(s: &String) -> &'static str {
16+
s.to_owned().leak()
1717
}
1818

1919
pub(crate) fn resolve_option_args(args: Option<Vec<String>>) -> Vec<String> {

0 commit comments

Comments
 (0)