Skip to main content

Module eager_or_lazy

Module eager_or_lazy 

Source
Expand description

Utilities for evaluating whether eagerly evaluated expressions can be made lazy and vice versa.

Things to consider:

  • does the expression have side-effects?
  • is the expression computationally expensive?

See lints:

  • unnecessary-lazy-evaluations
  • or-fun-call
  • option-if-let-else

Re-exportsยง

use crate::consts::ConstEvalCtxt; ๐Ÿ”’
use crate::consts::FullInt; ๐Ÿ”’
use crate::sym; ๐Ÿ”’
use crate::ty::all_clauses_of; ๐Ÿ”’
use crate::visitors::is_const_evaluatable; ๐Ÿ”’
use rustc_hir::def::DefKind; ๐Ÿ”’
use rustc_hir::def::Res; ๐Ÿ”’
use rustc_hir::def_id::DefId; ๐Ÿ”’
use rustc_hir::intravisit::Visitor; ๐Ÿ”’
use rustc_hir::intravisit::walk_expr; ๐Ÿ”’
use rustc_hir::BinOpKind; ๐Ÿ”’
use rustc_hir::Block; ๐Ÿ”’
use rustc_hir::Expr; ๐Ÿ”’
use rustc_hir::ExprKind; ๐Ÿ”’
use rustc_hir::QPath; ๐Ÿ”’
use rustc_hir::UnOp; ๐Ÿ”’
use rustc_lint::LateContext; ๐Ÿ”’
use rustc_middle::ty::adjustment::Adjust; ๐Ÿ”’
use rustc_middle::ty::adjustment::DerefAdjustKind; ๐Ÿ”’
use rustc_middle::ty; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_span::Symbol; ๐Ÿ”’
use std::cmp; ๐Ÿ”’
use std::ops; ๐Ÿ”’

Enumsยง

EagernessSuggestion ๐Ÿ”’

Functionsยง

expr_eagerness ๐Ÿ”’
fn_eagerness ๐Ÿ”’
Determine the eagerness of the given function call.
res_has_significant_drop ๐Ÿ”’
switch_to_eager_eval
Whether the given expression should be changed to evaluate eagerly
switch_to_lazy_eval
Whether the given expression should be changed to evaluate lazily