Skip to content

Commit a6a9194

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 8308b0f commit a6a9194

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/librustc_trans/back/link.rs

Lines changed: 9 additions & 7 deletions
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)