fix clippy::needless_return: remove unneeded return statements

This commit is contained in:
Matthias Krüger 2020-08-08 00:39:38 +02:00
parent ff692ab14f
commit a605e51056
9 changed files with 14 additions and 14 deletions

View File

@ -4,7 +4,7 @@ use std::env;
#[allow(deprecated)] #[allow(deprecated)]
pub fn get_concurrency() -> usize { pub fn get_concurrency() -> usize {
return match env::var("RUST_TEST_THREADS") { match env::var("RUST_TEST_THREADS") {
Ok(s) => { Ok(s) => {
let opt_n: Option<usize> = s.parse().ok(); let opt_n: Option<usize> = s.parse().ok();
match opt_n { match opt_n {
@ -13,7 +13,7 @@ pub fn get_concurrency() -> usize {
} }
} }
Err(..) => num_cpus(), Err(..) => num_cpus(),
}; }
} }
cfg_if::cfg_if! { cfg_if::cfg_if! {

View File

@ -960,7 +960,7 @@ fn pointer_type_metadata(
fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType { fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
debug!("param_type_metadata: {:?}", t); debug!("param_type_metadata: {:?}", t);
let name = format!("{:?}", t); let name = format!("{:?}", t);
return unsafe { unsafe {
llvm::LLVMRustDIBuilderCreateBasicType( llvm::LLVMRustDIBuilderCreateBasicType(
DIB(cx), DIB(cx),
name.as_ptr().cast(), name.as_ptr().cast(),
@ -968,7 +968,7 @@ fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
Size::ZERO.bits(), Size::ZERO.bits(),
DW_ATE_unsigned, DW_ATE_unsigned,
) )
}; }
} }
pub fn compile_unit_metadata( pub fn compile_unit_metadata(

View File

@ -288,9 +288,9 @@ impl<'me, 'tcx> LeakCheck<'me, 'tcx> {
) -> TypeError<'tcx> { ) -> TypeError<'tcx> {
debug!("error: placeholder={:?}, other_region={:?}", placeholder, other_region); debug!("error: placeholder={:?}, other_region={:?}", placeholder, other_region);
if self.overly_polymorphic { if self.overly_polymorphic {
return TypeError::RegionsOverlyPolymorphic(placeholder.name, other_region); TypeError::RegionsOverlyPolymorphic(placeholder.name, other_region)
} else { } else {
return TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, other_region); TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, other_region)
} }
} }
} }

View File

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

View File

@ -868,7 +868,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
} }
} }
} }
return normal_ret; normal_ret
} }
/// Finds the span of arguments of a closure (within `maybe_closure_span`) /// Finds the span of arguments of a closure (within `maybe_closure_span`)

View File

@ -361,7 +361,7 @@ fn optimization_applies<'tcx>(
} }
trace!("SUCCESS: optimization applies!"); trace!("SUCCESS: optimization applies!");
return true; true
} }
impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity { impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {

View File

@ -1030,7 +1030,7 @@ pub fn decode_expn_id<
drop(expns); drop(expns);
expn_id expn_id
}); });
return Ok(expn_id); Ok(expn_id)
} }
// Decodes `SyntaxContext`, using the provided `HygieneDecodeContext` // Decodes `SyntaxContext`, using the provided `HygieneDecodeContext`
@ -1103,7 +1103,7 @@ pub fn decode_syntax_context<
assert_eq!(dummy.dollar_crate_name, kw::Invalid); assert_eq!(dummy.dollar_crate_name, kw::Invalid);
}); });
return Ok(new_ctxt); Ok(new_ctxt)
} }
pub fn num_syntax_ctxts() -> usize { pub fn num_syntax_ctxts() -> usize {

View File

@ -174,7 +174,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
phantom_data: adt_def.is_phantom_data(), phantom_data: adt_def.is_phantom_data(),
}, },
}); });
return struct_datum; struct_datum
} }
fn fn_def_datum( fn fn_def_datum(

View File

@ -583,7 +583,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
self.tcx() self.tcx()
.sess .sess
.delay_span_bug(span, "struct or tuple struct pattern not applied to an ADT"); .delay_span_bug(span, "struct or tuple struct pattern not applied to an ADT");
return Err(()); Err(())
} }
} }
} }
@ -596,7 +596,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
ty::Tuple(substs) => Ok(substs.len()), ty::Tuple(substs) => Ok(substs.len()),
_ => { _ => {
self.tcx().sess.delay_span_bug(span, "tuple pattern not applied to a tuple"); self.tcx().sess.delay_span_bug(span, "tuple pattern not applied to a tuple");
return Err(()); Err(())
} }
} }
} }