do not leak string, use String

This commit is contained in:
manmen-mi 2026-05-26 09:56:51 +09:00
parent 7be43b1463
commit 41f60c4e91
2 changed files with 4 additions and 4 deletions

View File

@ -92,9 +92,9 @@ impl AppState {
.into_iter() .into_iter()
.map(|exercise_info| { .map(|exercise_info| {
let hint = if let Some(replacer) = &url_replacer { let hint = if let Some(replacer) = &url_replacer {
replacer.replace(exercise_info.hint.trim_ascii()).leak() replacer.replace(exercise_info.hint.trim_ascii())
} else { } else {
exercise_info.hint.trim_ascii() exercise_info.hint.trim_ascii().to_string()
}; };
let canonical_path = dir_canonical_path.as_deref().map(|dir_canonical_path| { let canonical_path = dir_canonical_path.as_deref().map(|dir_canonical_path| {
@ -628,7 +628,7 @@ mod tests {
canonical_path: None, canonical_path: None,
test: false, test: false,
strict_clippy: false, strict_clippy: false,
hint: "", hint: String::new(),
done: false, done: false,
} }
} }

View File

@ -73,7 +73,7 @@ pub struct Exercise {
pub canonical_path: Option<String>, pub canonical_path: Option<String>,
pub test: bool, pub test: bool,
pub strict_clippy: bool, pub strict_clippy: bool,
pub hint: &'static str, pub hint: String,
pub done: bool, pub done: bool,
} }