Skip to content

Commit 1a633e2

Browse files
committed
Split lines after newline
1 parent 9fecdba commit 1a633e2

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

src/cargo_toml.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ mod tests {
134134
);
135135

136136
assert_eq!(
137-
updated_cargo_toml(&exercise_infos, "abc\nbin = [xxx]\n123", b"../").unwrap(),
137+
updated_cargo_toml(
138+
&exercise_infos,
139+
"abc\n\
140+
bin = [xxx]\n\
141+
123",
142+
b"../"
143+
)
144+
.unwrap(),
138145
br#"abc
139146
bin = [
140147
{ name = "1", path = "../exercises/1.rs" },

src/dev/check.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,15 @@ fn check_info_file_exercises(info_file: &InfoFile) -> Result<HashSet<PathBuf>> {
106106

107107
if !file_buf.contains("fn main()") {
108108
bail!(
109-
"The `main` function is missing in the file `{path}`.\nCreate at least an empty `main` function to avoid language server errors"
109+
"The `main` function is missing in the file `{path}`.\n\
110+
Create at least an empty `main` function to avoid language server errors"
110111
);
111112
}
112113

113114
if !file_buf.contains("// TODO") {
114115
bail!(
115-
"Didn't find any `// TODO` comment in the file `{path}`.\nYou need to have at least one such comment to guide the user."
116+
"Didn't find any `// TODO` comment in the file `{path}`.\n\
117+
You need to have at least one such comment to guide the user."
116118
);
117119
}
118120

@@ -227,7 +229,10 @@ fn check_exercises_unsolved(
227229

228230
match result {
229231
Ok(true) => {
230-
bail!("The exercise {exercise_name} is already solved.\n{SKIP_CHECK_UNSOLVED_HINT}",)
232+
bail!(
233+
"The exercise {exercise_name} is already solved.\n\
234+
{SKIP_CHECK_UNSOLVED_HINT}",
235+
)
231236
}
232237
Ok(false) => (),
233238
Err(e) => return Err(e),
@@ -242,10 +247,12 @@ fn check_exercises_unsolved(
242247
fn check_exercises(info_file: &'static InfoFile, cmd_runner: &'static CmdRunner) -> Result<()> {
243248
match info_file.format_version.cmp(&CURRENT_FORMAT_VERSION) {
244249
Ordering::Less => bail!(
245-
"`format_version` < {CURRENT_FORMAT_VERSION} (supported version)\nPlease migrate to the latest format version"
250+
"`format_version` < {CURRENT_FORMAT_VERSION} (supported version)\n\
251+
Please migrate to the latest format version"
246252
),
247253
Ordering::Greater => bail!(
248-
"`format_version` > {CURRENT_FORMAT_VERSION} (supported version)\nTry updating the Rustlings program"
254+
"`format_version` > {CURRENT_FORMAT_VERSION} (supported version)\n\
255+
Try updating the Rustlings program"
249256
),
250257
Ordering::Equal => (),
251258
}

src/init.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ pub fn init() -> Result<()> {
5858
&& !workspace_manifest_content.contains("workspace.")
5959
{
6060
bail!(
61-
"The current directory is already part of a Cargo project.\nPlease initialize Rustlings in a different directory"
61+
"The current directory is already part of a Cargo project.\n\
62+
Please initialize Rustlings in a different directory"
6263
);
6364
}
6465

65-
stdout.write_all(b"This command will create the directory `rustlings/` as a member of this Cargo workspace.\nPress ENTER to continue ")?;
66+
stdout.write_all(b"This command will create the directory `rustlings/` as a member of this Cargo workspace.\n\
67+
Press ENTER to continue ")?;
6668
press_enter_prompt(&mut stdout)?;
6769

6870
// Make sure "rustlings" is added to `workspace.members` by making
@@ -78,7 +80,8 @@ pub fn init() -> Result<()> {
7880
.status()?;
7981
if !status.success() {
8082
bail!(
81-
"Failed to initialize a new Cargo workspace member.\nPlease initialize Rustlings in a different directory"
83+
"Failed to initialize a new Cargo workspace member.\n\
84+
Please initialize Rustlings in a different directory"
8285
);
8386
}
8487

@@ -87,7 +90,8 @@ pub fn init() -> Result<()> {
8790
.context("Failed to remove the temporary directory `rustlings/`")?;
8891
init_git = false;
8992
} else {
90-
stdout.write_all(b"This command will create the directory `rustlings/` which will contain the exercises.\nPress ENTER to continue ")?;
93+
stdout.write_all(b"This command will create the directory `rustlings/` which will contain the exercises.\n\
94+
Press ENTER to continue ")?;
9195
press_enter_prompt(&mut stdout)?;
9296
}
9397

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ fn main() -> Result<ExitCode> {
104104
clear_terminal(&mut stdout)?;
105105

106106
let welcome_message = welcome_message.trim_ascii();
107-
write!(stdout, "{welcome_message}\n\nPress ENTER to continue ")?;
107+
write!(
108+
stdout,
109+
"{welcome_message}\n\n\
110+
Press ENTER to continue "
111+
)?;
108112
press_enter_prompt(&mut stdout)?;
109113
clear_terminal(&mut stdout)?;
110114
// Flush to be able to show errors occurring before printing a newline to stdout.

0 commit comments

Comments
 (0)