mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-06-30 00:08:45 +00:00
do not leak string, use String
This commit is contained in:
parent
7be43b1463
commit
41f60c4e91
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user