Skip to content

Commit 104322c

Browse files
committed
Extract post_install_msg_unix_source_env!()
1 parent a7a54b0 commit 104322c

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

src/cli/self_update.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,9 @@ but will not be added automatically."
216216
}
217217

218218
#[cfg(not(windows))]
219-
macro_rules! post_install_msg_unix {
219+
macro_rules! post_install_msg_unix_source_env {
220220
() => {
221-
r#"# Rust is installed now. Great!
222-
223-
To get started you may need to restart your current shell.
224-
This would reload your `PATH` environment variable to include
225-
Cargo's bin directory ({cargo_home}/bin).
226-
227-
To configure your current shell, you need to source
221+
r#"To configure your current shell, you need to source
228222
the corresponding `env` file under {cargo_home}.
229223
230224
This is usually done by running one of the following:
@@ -235,6 +229,22 @@ This is usually done by running one of the following:
235229
};
236230
}
237231

232+
#[cfg(not(windows))]
233+
macro_rules! post_install_msg_unix {
234+
() => {
235+
concat!(
236+
r"# Rust is installed now. Great!
237+
238+
To get started you may need to restart your current shell.
239+
This would reload your `PATH` environment variable to include
240+
Cargo's bin directory ({cargo_home}/bin).
241+
242+
",
243+
post_install_msg_unix_source_env!(),
244+
)
245+
};
246+
}
247+
238248
#[cfg(windows)]
239249
macro_rules! post_install_msg_win {
240250
() => {
@@ -251,19 +261,15 @@ Cargo's bin directory ({cargo_home}\\bin).
251261
#[cfg(not(windows))]
252262
macro_rules! post_install_msg_unix_no_modify_path {
253263
() => {
254-
r#"# Rust is installed now. Great!
264+
concat!(
265+
r"# Rust is installed now. Great!
255266
256267
To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH`
257268
environment variable. This has not been done automatically.
258269
259-
To configure your current shell, you need to source
260-
the corresponding `env` file under {cargo_home}.
261-
262-
This is usually done by running one of the following:
263-
source "{cargo_home}/env" # For bash/zsh
264-
. "{cargo_home}/env" # For ash/dash/pdksh (note the leading DOT)
265-
source "{cargo_home}/env.fish" # For fish
266-
"#
270+
",
271+
post_install_msg_unix_source_env!(),
272+
)
267273
};
268274
}
269275

0 commit comments

Comments
 (0)