Use () for entry_fn.

This commit is contained in:
Camille GILLOT 2021-05-11 12:00:59 +02:00
parent c5a3f1c306
commit b03b74734b

View file

@ -60,7 +60,7 @@ use rustc_ast::ast::{self, Attribute, BorrowKind, LitKind};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, walk_expr, ErasedMap, FnKind, NestedVisitorMap, Visitor};
use rustc_hir::LangItem::{ResultErr, ResultOk};
use rustc_hir::{
@ -677,7 +677,7 @@ pub fn method_chain_args<'a>(expr: &'a Expr<'_>, methods: &[&str]) -> Option<Vec
/// Returns `true` if the provided `def_id` is an entrypoint to a program.
pub fn is_entrypoint_fn(cx: &LateContext<'_>, def_id: DefId) -> bool {
cx.tcx
.entry_fn(LOCAL_CRATE)
.entry_fn(())
.map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id)
}