about summary refs log tree commit diff
path: root/src/librustc_save_analysis/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-23 06:02:34 +0000
committerbors <bors@rust-lang.org>2020-03-23 06:02:34 +0000
commit8ff785011be6625e32afceee3a08e5cff7470feb (patch)
treef9a842b8f8e390c261192943061f48d6754f65da /src/librustc_save_analysis/lib.rs
parent37c945dd6178cb520eb1e450a795f8c3b3cc5a3b (diff)
parent5f91f30b0ace8a687e1acd2e057e27d4b57ad364 (diff)
Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #69251 (#[track_caller] in traits)
 - #69880 (miri engine: turn error sanity checks into assertions)
 - #70207 (Use getentropy(2) on macos)
 - #70227 (Only display definition when suggesting a typo)
 - #70236 (resolve: Avoid "self-confirming" import resolutions in one more case)
 - #70248 (parser: simplify & remove unused field)
 - #70249 (handle ConstKind::Unresolved after monomorphizing)
 - #70269 (remove redundant closures (clippy::redundant_closure))
 - #70270 (Clean up E0449 explanation)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_save_analysis/lib.rs')
-rw-r--r--src/librustc_save_analysis/lib.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index bb717981a3b..024633c3b3d 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -326,7 +326,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
                                     .as_ref()
                                     .and_then(|t| self.lookup_def_id(t.ref_id))
                                     .map(id_from_def_id)
-                                    .unwrap_or_else(|| null_id()),
+                                    .unwrap_or_else(null_id),
                             },
                             Impl {
                                 id: impl_id,
@@ -487,9 +487,9 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
             qualname,
             // FIXME you get better data here by using the visitor.
             value: String::new(),
-            parent: parent_scope.map(|id| id_from_def_id(id)),
+            parent: parent_scope.map(id_from_def_id),
             children: vec![],
-            decl_id: decl_id.map(|id| id_from_def_id(id)),
+            decl_id: decl_id.map(id_from_def_id),
             docs,
             sig: None,
             attributes: lower_attributes(attributes, self),
@@ -541,7 +541,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
                                 .tcx
                                 .find_field_index(ident, variant)
                                 .map(|index| id_from_def_id(variant.fields[index].did))
-                                .unwrap_or_else(|| null_id()),
+                                .unwrap_or_else(null_id),
                         }))
                     }
                     ty::Tuple(..) => None,
@@ -590,14 +590,11 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
                 Some(Data::RefData(Ref {
                     kind: RefKind::Function,
                     span,
-                    ref_id: def_id
-                        .or(decl_id)
-                        .map(|id| id_from_def_id(id))
-                        .unwrap_or_else(|| null_id()),
+                    ref_id: def_id.or(decl_id).map(id_from_def_id).unwrap_or_else(|| null_id()),
                 }))
             }
             ast::ExprKind::Path(_, ref path) => {
-                self.get_path_data(expr.id, path).map(|d| Data::RefData(d))
+                self.get_path_data(expr.id, path).map(Data::RefData)
             }
             _ => {
                 // FIXME
@@ -1075,7 +1072,7 @@ fn id_from_def_id(id: DefId) -> rls_data::Id {
 
 fn id_from_node_id(id: NodeId, scx: &SaveContext<'_, '_>) -> rls_data::Id {
     let def_id = scx.tcx.hir().opt_local_def_id_from_node_id(id);
-    def_id.map(|id| id_from_def_id(id)).unwrap_or_else(|| {
+    def_id.map(id_from_def_id).unwrap_or_else(|| {
         // Create a *fake* `DefId` out of a `NodeId` by subtracting the `NodeId`
         // out of the maximum u32 value. This will work unless you have *billions*
         // of definitions in a single crate (very unlikely to actually happen).