remove unused return types such as empty Results or Options that would always be Some(..)
remove unused return type of dropck::check_drop_obligations() don't wrap return type in Option in get_macro_by_def_id() since we would always return Some(..) remove redundant return type of back::write::optimize() don't Option-wrap return type of compute_type_parameters() since we always return Some(..) don't return empty Result in assemble_generator_candidates() don't return empty Result in assemble_closure_candidates() don't return empty result in assemble_fn_pointer_candidates() don't return empty result in assemble_candidates_from_impls() don't return empty result in assemble_candidates_from_auto_impls() don't return emtpy result in assemble_candidates_for_trait_alias() don't return empty result in assemble_builtin_bound_candidates() don't return empty results in assemble_extension_candidates_for_traits_in_scope() and assemble_extension_candidates_for_trait() remove redundant wrapping of return type of StripItem::strip() since it always returns Some(..) remove unused return type of assemble_extension_candidates_for_all_traits()
This commit is contained in:
parent
b9c403be11
commit
e5ead5fc58
12 changed files with 56 additions and 81 deletions
|
@ -185,15 +185,15 @@ impl<'a> Resolver<'a> {
|
|||
|
||||
crate fn get_macro(&mut self, res: Res) -> Option<Lrc<SyntaxExtension>> {
|
||||
match res {
|
||||
Res::Def(DefKind::Macro(..), def_id) => self.get_macro_by_def_id(def_id),
|
||||
Res::Def(DefKind::Macro(..), def_id) => Some(self.get_macro_by_def_id(def_id)),
|
||||
Res::NonMacroAttr(attr_kind) => Some(self.non_macro_attr(attr_kind.is_used())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
crate fn get_macro_by_def_id(&mut self, def_id: DefId) -> Option<Lrc<SyntaxExtension>> {
|
||||
crate fn get_macro_by_def_id(&mut self, def_id: DefId) -> Lrc<SyntaxExtension> {
|
||||
if let Some(ext) = self.macro_map.get(&def_id) {
|
||||
return Some(ext.clone());
|
||||
return ext.clone();
|
||||
}
|
||||
|
||||
let ext = Lrc::new(match self.cstore().load_macro_untracked(def_id, &self.session) {
|
||||
|
@ -202,7 +202,7 @@ impl<'a> Resolver<'a> {
|
|||
});
|
||||
|
||||
self.macro_map.insert(def_id, ext.clone());
|
||||
Some(ext)
|
||||
ext
|
||||
}
|
||||
|
||||
crate fn build_reduced_graph(
|
||||
|
|
|
@ -1991,14 +1991,13 @@ impl<'a> Resolver<'a> {
|
|||
{
|
||||
// The macro is a proc macro derive
|
||||
if let Some(def_id) = module.expansion.expn_data().macro_def_id {
|
||||
if let Some(ext) = self.get_macro_by_def_id(def_id) {
|
||||
if !ext.is_builtin
|
||||
&& ext.macro_kind() == MacroKind::Derive
|
||||
&& parent.expansion.outer_expn_is_descendant_of(span.ctxt())
|
||||
{
|
||||
*poisoned = Some(node_id);
|
||||
return module.parent;
|
||||
}
|
||||
let ext = self.get_macro_by_def_id(def_id);
|
||||
if !ext.is_builtin
|
||||
&& ext.macro_kind() == MacroKind::Derive
|
||||
&& parent.expansion.outer_expn_is_descendant_of(span.ctxt())
|
||||
{
|
||||
*poisoned = Some(node_id);
|
||||
return module.parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue