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()
.map(|exercise_info| {
let hint = if let Some(replacer) = &url_replacer {
replacer.replace(exercise_info.hint.trim_ascii()).leak()
replacer.replace(exercise_info.hint.trim_ascii())
} 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| {
@ -628,7 +628,7 @@ mod tests {
canonical_path: None,
test: false,
strict_clippy: false,
hint: "",
hint: String::new(),
done: false,
}
}

View File

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