Rollup merge of #130114 - eduardosm:needless-returns, r=compiler-errors
Remove needless returns detected by clippy in the compiler
This commit is contained in:
@@ -71,7 +71,7 @@ impl<'hir> Iterator for ParentHirIterator<'hir> {
|
||||
debug_assert_ne!(parent_id, self.current_id);
|
||||
|
||||
self.current_id = parent_id;
|
||||
return Some(parent_id);
|
||||
Some(parent_id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ impl<'hir> Iterator for ParentOwnerIterator<'hir> {
|
||||
self.current_id = HirId::make_owner(parent_id.def_id);
|
||||
|
||||
let node = self.map.tcx.hir_owner_node(self.current_id.owner);
|
||||
return Some((self.current_id.owner, node));
|
||||
Some((self.current_id.owner, node))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1233,14 +1233,14 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalModDefId) -> Mod
|
||||
body_owners,
|
||||
..
|
||||
} = collector;
|
||||
return ModuleItems {
|
||||
ModuleItems {
|
||||
submodules: submodules.into_boxed_slice(),
|
||||
free_items: items.into_boxed_slice(),
|
||||
trait_items: trait_items.into_boxed_slice(),
|
||||
impl_items: impl_items.into_boxed_slice(),
|
||||
foreign_items: foreign_items.into_boxed_slice(),
|
||||
body_owners: body_owners.into_boxed_slice(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
|
||||
@@ -1262,14 +1262,14 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
|
||||
..
|
||||
} = collector;
|
||||
|
||||
return ModuleItems {
|
||||
ModuleItems {
|
||||
submodules: submodules.into_boxed_slice(),
|
||||
free_items: items.into_boxed_slice(),
|
||||
trait_items: trait_items.into_boxed_slice(),
|
||||
impl_items: impl_items.into_boxed_slice(),
|
||||
foreign_items: foreign_items.into_boxed_slice(),
|
||||
body_owners: body_owners.into_boxed_slice(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
struct ItemCollector<'tcx> {
|
||||
|
||||
@@ -641,7 +641,7 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
|
||||
pub fn write_uninit(&mut self, cx: &impl HasDataLayout, range: AllocRange) -> AllocResult {
|
||||
self.mark_init(range, false);
|
||||
self.provenance.clear(range, cx)?;
|
||||
return Ok(());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove all provenance in the given memory range.
|
||||
|
||||
@@ -1166,10 +1166,9 @@ impl<'tcx> LocalDecl<'tcx> {
|
||||
/// Returns `true` if this is a DerefTemp
|
||||
pub fn is_deref_temp(&self) -> bool {
|
||||
match self.local_info() {
|
||||
LocalInfo::DerefTemp => return true,
|
||||
_ => (),
|
||||
LocalInfo::DerefTemp => true,
|
||||
_ => false,
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Returns `true` is the local is from a compiler desugaring, e.g.,
|
||||
|
||||
@@ -2007,7 +2007,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
));
|
||||
}
|
||||
}
|
||||
return None;
|
||||
None
|
||||
}
|
||||
|
||||
/// Checks if the bound region is in Impl Item.
|
||||
|
||||
@@ -431,7 +431,7 @@ impl BoundRegionKind {
|
||||
|
||||
pub fn get_id(&self) -> Option<DefId> {
|
||||
match *self {
|
||||
BoundRegionKind::BrNamed(id, _) => return Some(id),
|
||||
BoundRegionKind::BrNamed(id, _) => Some(id),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user