1
Fork 0

Rollup merge of #69571 - matthiaskrgr:useless_asref, r=Centril

remove unneeded .as_ref() calls.
This commit is contained in:
Dylan DPC 2020-02-29 18:53:59 +01:00 committed by GitHub
commit b22631bfaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -657,7 +657,7 @@ impl EmbargoVisitor<'tcx> {
.map(|module_hir_id| self.tcx.hir().expect_item(module_hir_id)) .map(|module_hir_id| self.tcx.hir().expect_item(module_hir_id))
{ {
if let hir::ItemKind::Mod(m) = &item.kind { if let hir::ItemKind::Mod(m) = &item.kind {
for item_id in m.item_ids.as_ref() { for item_id in m.item_ids {
let item = self.tcx.hir().expect_item(item_id.id); let item = self.tcx.hir().expect_item(item_id.id);
let def_id = self.tcx.hir().local_def_id(item_id.id); let def_id = self.tcx.hir().local_def_id(item_id.id);
if !self.tcx.hygienic_eq(segment.ident, item.ident, def_id) { if !self.tcx.hygienic_eq(segment.ident, item.ident, def_id) {

View file

@ -239,7 +239,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
.segments .segments
.iter() .iter()
.filter_map(|seg| seg.args.as_ref()) .filter_map(|seg| seg.args.as_ref())
.map(|generic_args| generic_args.args.as_ref()) .map(|generic_args| generic_args.args)
.find_map(|args| { .find_map(|args| {
args.iter() args.iter()
.filter(|arg| arg.is_const()) .filter(|arg| arg.is_const())

View file

@ -2011,7 +2011,7 @@ impl Path {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn file_name(&self) -> Option<&OsStr> { pub fn file_name(&self) -> Option<&OsStr> {
self.components().next_back().and_then(|p| match p { self.components().next_back().and_then(|p| match p {
Component::Normal(p) => Some(p.as_ref()), Component::Normal(p) => Some(p),
_ => None, _ => None,
}) })
} }