Skip to content

Commit a605e51

Browse files
committed
fix clippy::needless_return: remove unneeded return statements
1 parent ff692ab commit a605e51

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

library/test/src/helpers/concurrency.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::env;
44

55
#[allow(deprecated)]
66
pub fn get_concurrency() -> usize {
7-
return match env::var("RUST_TEST_THREADS") {
7+
match env::var("RUST_TEST_THREADS") {
88
Ok(s) => {
99
let opt_n: Option<usize> = s.parse().ok();
1010
match opt_n {
@@ -13,7 +13,7 @@ pub fn get_concurrency() -> usize {
1313
}
1414
}
1515
Err(..) => num_cpus(),
16-
};
16+
}
1717
}
1818

1919
cfg_if::cfg_if! {

src/librustc_codegen_llvm/debuginfo/metadata.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -960,15 +960,15 @@ fn pointer_type_metadata(
960960
fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
961961
debug!("param_type_metadata: {:?}", t);
962962
let name = format!("{:?}", t);
963-
return unsafe {
963+
unsafe {
964964
llvm::LLVMRustDIBuilderCreateBasicType(
965965
DIB(cx),
966966
name.as_ptr().cast(),
967967
name.len(),
968968
Size::ZERO.bits(),
969969
DW_ATE_unsigned,
970970
)
971-
};
971+
}
972972
}
973973

974974
pub fn compile_unit_metadata(

src/librustc_infer/infer/region_constraints/leak_check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ impl<'me, 'tcx> LeakCheck<'me, 'tcx> {
288288
) -> TypeError<'tcx> {
289289
debug!("error: placeholder={:?}, other_region={:?}", placeholder, other_region);
290290
if self.overly_polymorphic {
291-
return TypeError::RegionsOverlyPolymorphic(placeholder.name, other_region);
291+
TypeError::RegionsOverlyPolymorphic(placeholder.name, other_region)
292292
} else {
293-
return TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, other_region);
293+
TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, other_region)
294294
}
295295
}
296296
}

src/librustc_lint/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
10741074
}
10751075
// If `ty` is a `repr(transparent)` newtype, and the non-zero-sized type is a generic
10761076
// argument, which after substitution, is `()`, then this branch can be hit.
1077-
FfiResult::FfiUnsafe { ty, .. } if is_return_type && ty.is_unit() => return,
1077+
FfiResult::FfiUnsafe { ty, .. } if is_return_type && ty.is_unit() => {}
10781078
FfiResult::FfiUnsafe { ty, reason, help } => {
10791079
self.emit_ffi_unsafe_type_lint(ty, sp, &reason, help.as_deref());
10801080
}

src/librustc_mir/borrow_check/diagnostics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
868868
}
869869
}
870870
}
871-
return normal_ret;
871+
normal_ret
872872
}
873873

874874
/// Finds the span of arguments of a closure (within `maybe_closure_span`)

src/librustc_mir/transform/simplify_try.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ fn optimization_applies<'tcx>(
361361
}
362362

363363
trace!("SUCCESS: optimization applies!");
364-
return true;
364+
true
365365
}
366366

367367
impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {

src/librustc_span/hygiene.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ pub fn decode_expn_id<
10301030
drop(expns);
10311031
expn_id
10321032
});
1033-
return Ok(expn_id);
1033+
Ok(expn_id)
10341034
}
10351035

10361036
// Decodes `SyntaxContext`, using the provided `HygieneDecodeContext`
@@ -1103,7 +1103,7 @@ pub fn decode_syntax_context<
11031103
assert_eq!(dummy.dollar_crate_name, kw::Invalid);
11041104
});
11051105

1106-
return Ok(new_ctxt);
1106+
Ok(new_ctxt)
11071107
}
11081108

11091109
pub fn num_syntax_ctxts() -> usize {

src/librustc_traits/chalk/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
174174
phantom_data: adt_def.is_phantom_data(),
175175
},
176176
});
177-
return struct_datum;
177+
struct_datum
178178
}
179179

180180
fn fn_def_datum(

src/librustc_typeck/mem_categorization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
583583
self.tcx()
584584
.sess
585585
.delay_span_bug(span, "struct or tuple struct pattern not applied to an ADT");
586-
return Err(());
586+
Err(())
587587
}
588588
}
589589
}
@@ -596,7 +596,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
596596
ty::Tuple(substs) => Ok(substs.len()),
597597
_ => {
598598
self.tcx().sess.delay_span_bug(span, "tuple pattern not applied to a tuple");
599-
return Err(());
599+
Err(())
600600
}
601601
}
602602
}

0 commit comments

Comments
 (0)