remove unwrap_or! macro
This commit is contained in:
parent
44995f7afb
commit
77fce75ba1
3 changed files with 8 additions and 17 deletions
|
@ -20,16 +20,6 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustc_macros;
|
extern crate rustc_macros;
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! unwrap_or {
|
|
||||||
($opt:expr, $default:expr) => {
|
|
||||||
match $opt {
|
|
||||||
Some(x) => x,
|
|
||||||
None => $default,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod util {
|
pub mod util {
|
||||||
pub mod classify;
|
pub mod classify;
|
||||||
pub mod comments;
|
pub mod comments;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use crate::context::{CheckLintNameResult, LintStore};
|
use crate::context::{CheckLintNameResult, LintStore};
|
||||||
use crate::late::unerased_lint_store;
|
use crate::late::unerased_lint_store;
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_ast::unwrap_or;
|
|
||||||
use rustc_ast_pretty::pprust;
|
use rustc_ast_pretty::pprust;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
||||||
|
@ -233,7 +232,10 @@ impl<'s> LintLevelsBuilder<'s> {
|
||||||
Some(lvl) => lvl,
|
Some(lvl) => lvl,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut metas = unwrap_or!(attr.meta_item_list(), continue);
|
let mut metas = match attr.meta_item_list() {
|
||||||
|
Some(x) => x,
|
||||||
|
None => continue,
|
||||||
|
};
|
||||||
|
|
||||||
if metas.is_empty() {
|
if metas.is_empty() {
|
||||||
// FIXME (#55112): issue unused-attributes lint for `#[level()]`
|
// FIXME (#55112): issue unused-attributes lint for `#[level()]`
|
||||||
|
|
|
@ -9,7 +9,6 @@ use crate::{BindingKey, ModuleKind, ResolutionError, Resolver, Segment};
|
||||||
use crate::{CrateLint, Module, ModuleOrUniformRoot, ParentScope, PerNS, ScopeSet, Weak};
|
use crate::{CrateLint, Module, ModuleOrUniformRoot, ParentScope, PerNS, ScopeSet, Weak};
|
||||||
use crate::{NameBinding, NameBindingKind, PathResult, PrivacyError, ToNameBinding};
|
use crate::{NameBinding, NameBindingKind, PathResult, PrivacyError, ToNameBinding};
|
||||||
|
|
||||||
use rustc_ast::unwrap_or;
|
|
||||||
use rustc_ast::NodeId;
|
use rustc_ast::NodeId;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_data_structures::ptr_key::PtrKey;
|
use rustc_data_structures::ptr_key::PtrKey;
|
||||||
|
@ -349,10 +348,10 @@ impl<'a> Resolver<'a> {
|
||||||
if !self.is_accessible_from(single_import.vis.get(), parent_scope.module) {
|
if !self.is_accessible_from(single_import.vis.get(), parent_scope.module) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let module = unwrap_or!(
|
let module = match single_import.imported_module.get() {
|
||||||
single_import.imported_module.get(),
|
Some(x) => x,
|
||||||
return Err((Undetermined, Weak::No))
|
None => return Err((Undetermined, Weak::No)),
|
||||||
);
|
};
|
||||||
let ident = match single_import.kind {
|
let ident = match single_import.kind {
|
||||||
ImportKind::Single { source, .. } => source,
|
ImportKind::Single { source, .. } => source,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue