mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
remove unnecessary lazy evaluations
This commit is contained in:
parent
7530d76f00
commit
cc80c5bd07
31 changed files with 50 additions and 51 deletions
|
@ -159,15 +159,14 @@ impl ItemScope {
|
|||
pub(crate) fn name_of(&self, item: ItemInNs) -> Option<(&Name, Visibility)> {
|
||||
let (def, mut iter) = match item {
|
||||
ItemInNs::Macros(def) => {
|
||||
return self
|
||||
.macros
|
||||
.iter()
|
||||
.find_map(|(name, &(other_def, vis))| (other_def == def).then(|| (name, vis)));
|
||||
return self.macros.iter().find_map(|(name, &(other_def, vis))| {
|
||||
(other_def == def).then_some((name, vis))
|
||||
});
|
||||
}
|
||||
ItemInNs::Types(def) => (def, self.types.iter()),
|
||||
ItemInNs::Values(def) => (def, self.values.iter()),
|
||||
};
|
||||
iter.find_map(|(name, &(other_def, vis))| (other_def == def).then(|| (name, vis)))
|
||||
iter.find_map(|(name, &(other_def, vis))| (other_def == def).then_some((name, vis)))
|
||||
}
|
||||
|
||||
pub(crate) fn traits<'a>(&'a self) -> impl Iterator<Item = TraitId> + 'a {
|
||||
|
|
|
@ -170,7 +170,7 @@ pub fn identity_when_valid(_attr: TokenStream, item: TokenStream) -> TokenStream
|
|||
}
|
||||
let pp = pretty_print_macro_expansion(
|
||||
parse.syntax_node(),
|
||||
show_token_ids.then(|| &*token_map),
|
||||
show_token_ids.then_some(&*token_map),
|
||||
);
|
||||
let indent = IndentLevel::from_node(call.syntax());
|
||||
let pp = reindent(indent, pp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue