Skip to content

Commit 11f459c

Browse files
committed
refactor(dist): extract "nightly tips" out of the match block in components_missing_msg()
1 parent 342ce32 commit 11f459c

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

src/dist/mod.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,6 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
7575
c.description(manifest),
7676
toolchain,
7777
);
78-
79-
if toolchain.starts_with("nightly") {
80-
let _ = write!(buf, "{nightly_tips}");
81-
}
82-
83-
let _ = write!(
84-
buf,
85-
"If you don't need the component, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
86-
);
8778
}
8879
cs => {
8980
let cs_str = cs
@@ -95,18 +86,17 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
9586
buf,
9687
"some components are unavailable for download for channel '{toolchain}': {cs_str}"
9788
);
98-
99-
if toolchain.starts_with("nightly") {
100-
let _ = write!(buf, "{nightly_tips}");
101-
}
102-
103-
let _ = write!(
104-
buf,
105-
"If you don't need the components, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
106-
);
10789
}
10890
}
10991

92+
if toolchain.starts_with("nightly") {
93+
let _ = write!(buf, "{nightly_tips}");
94+
95+
let _ = write!(
96+
buf,
97+
"If you don't need the component(s), you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
98+
);
99+
}
110100
String::from_utf8(buf).unwrap()
111101
}
112102

0 commit comments

Comments
 (0)