Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3f2aa2a

Browse files
fix: replace dashes with underscores in slug for valid Rust module names
1 parent feddec6 commit 3f2aa2a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/helper.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ mod file {
197197
pub fn test_cases_path(problem: &Problem) -> crate::Result<String> {
198198
let conf = crate::config::Config::locate()?;
199199
let mut path = format!("{}/{}.tests.dat", conf.storage.code()?, conf.code.pick);
200-
200+
let safe_slug = problem.slug.replace("-","_");
201201
path = path.replace("${fid}", &problem.fid.to_string());
202-
path = path.replace("${slug}", &problem.slug.to_string());
202+
path = path.replace("${slug}", &safe_slug);
203203
Ok(path)
204204
}
205205

@@ -217,9 +217,9 @@ mod file {
217217
conf.code.pick,
218218
suffix(&lang)?,
219219
);
220-
220+
let safe_slug = problem.slug.replace("-","_");
221221
path = path.replace("${fid}", &problem.fid.to_string());
222-
path = path.replace("${slug}", &problem.slug.to_string());
222+
path = path.replace("${slug}", &safe_slug);
223223

224224
Ok(path)
225225
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /