use if_chain::if_chain;
use rustc_ast::ast::{Expr, ExprKind};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use if_chain::if_chain;
use rustc_ast::ast::{Expr, ExprKind};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
/// at run-time if the environment variable doesn't exist, whereas `env!`
/// catches it at compile-time.
///
/// at run-time if the environment variable doesn't exist, whereas `env!`
/// catches it at compile-time.
///
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if_chain! {
if let ExprKind::MethodCall(path_segment, args, _) = &expr.kind;
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if_chain! {
if let ExprKind::MethodCall(path_segment, args, _) = &expr.kind;
if let ExprKind::Call(caller, _) = &args[0].kind;
if is_direct_expn_of(caller.span, "option_env").is_some();
then {
if let ExprKind::Call(caller, _) = &args[0].kind;
if is_direct_expn_of(caller.span, "option_env").is_some();
then {