Skip to content

Commit eaa8591

Browse files
committed
Use an early return.
If there's nothing to do, returning early saves an indentation level and reduces the amount of state one needs to track reading the code.
1 parent f56e71f commit eaa8591

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/librustc_trans/back/link.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -826,15 +826,17 @@ fn link_staticlib(sess: &Session, objects: &[PathBuf], out_filename: &Path,
826826
}
827827

828828
fn report_link_line(sess: &Session, native_libs: Vec<(NativeLibraryKind, String)>) {
829-
if !native_libs.is_empty() {
830-
sess.note_without_error(
831-
"link against the following native artifacts when linking against \
832-
this static library");
833-
sess.note_without_error(
834-
"the order and any duplication can be significant on some \
835-
platforms, and so may need to be preserved");
829+
if native_libs.is_empty() {
830+
return;
836831
}
837832

833+
sess.note_without_error(
834+
"link against the following native artifacts when linking against \
835+
this static library");
836+
sess.note_without_error(
837+
"the order and any duplication can be significant on some \
838+
platforms, and so may need to be preserved");
839+
838840
for &(kind, ref lib) in &native_libs {
839841
let name = match kind {
840842
NativeLibraryKind::NativeStatic => "static library",

0 commit comments

Comments
 (0)