Skip to content

Commit

Permalink
fix rust linter errors
Browse files Browse the repository at this point in the history
Summary: This fixes several  clippy::needless_return and clippy::empty_line_after_doc_comment errors.

Reviewed By: madgen

Differential Revision: D67517609

fbshipit-source-id: b5f9bf9f43bffc13475c172f3dda1087a919f755
  • Loading branch information
Francesco Zappa Nardelli authored and facebook-github-bot committed Dec 20, 2024
1 parent 1f516d3 commit 8ecc723
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion hphp/hack/src/hackrs/ty/decl/folded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct FoldedElement {
/// class B<Tb> extends A<Tb, int> {}
/// class C extends B<string> {}
/// ```
///
/// The method `A::test()` has the type `(function(Ta1, Ta2): void)` in the
/// context of class `A`. However in the context of class `B`, it will have type
/// `(function(Tb, int): void)`.
Expand Down
4 changes: 2 additions & 2 deletions hphp/hack/src/parser/core/declaration_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,10 +1571,10 @@ where
let token_kind = self.peek_token_kind();
if token_kind == TokenKind::Readonly {
let token = self.next_token();
return self.sc_mut().make_token(token);
self.sc_mut().make_token(token)
} else {
let pos = self.pos();
return self.sc_mut().make_missing(pos);
self.sc_mut().make_missing(pos)
}
}

Expand Down
20 changes: 10 additions & 10 deletions hphp/hack/src/parser/lowerer/lowerer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3756,55 +3756,55 @@ fn is_polymorphic_context<'a>(env: &mut Env<'a>, hint: &ast::Hint, ignore_this:

fn has_polymorphic_context<'a>(env: &mut Env<'a>, contexts: Option<&ast::Contexts>) -> bool {
if let Some(ast::Contexts(_, ref context_hints)) = contexts {
return context_hints
context_hints
.iter()
.any(|c| is_polymorphic_context(env, c, false));
.any(|c| is_polymorphic_context(env, c, false))
} else {
false
}
}

fn has_any_policied_context(contexts: Option<&ast::Contexts>) -> bool {
if let Some(ast::Contexts(_, ref context_hints)) = contexts {
return context_hints.iter().any(|hint| match &*hint.1 {
context_hints.iter().any(|hint| match &*hint.1 {
ast::Hint_::Happly(ast::Id(_, id), _) => sn::coeffects::is_any_zoned(id),
_ => false,
});
})
} else {
false
}
}

fn has_any_policied_or_defaults_context(contexts: Option<&ast::Contexts>) -> bool {
if let Some(ast::Contexts(_, ref context_hints)) = contexts {
return context_hints.iter().any(|hint| match &*hint.1 {
context_hints.iter().any(|hint| match &*hint.1 {
ast::Hint_::Happly(ast::Id(_, id), _) => sn::coeffects::is_any_zoned_or_defaults(id),
_ => false,
});
})
} else {
true
}
}

fn has_any_context(haystack: Option<&ast::Contexts>, needles: Vec<&str>) -> bool {
if let Some(ast::Contexts(_, ref context_hints)) = haystack {
return context_hints.iter().any(|hint| match &*hint.1 {
context_hints.iter().any(|hint| match &*hint.1 {
ast::Hint_::Happly(ast::Id(_, id), _) => needles.iter().any(|&context| id == context),
_ => false,
});
})
} else {
true
}
}

fn contexts_cannot_access_ic(haystack: Option<&ast::Contexts>) -> bool {
if let Some(ast::Contexts(_, ref context_hints)) = haystack {
return context_hints.iter().all(|hint| match &*hint.1 {
context_hints.iter().all(|hint| match &*hint.1 {
ast::Hint_::Happly(ast::Id(_, id), _) => {
sn::coeffects::is_any_without_implicit_policy_or_unsafe(id)
}
_ => false,
});
})
} else {
false // no context list -> implicit [defaults]
}
Expand Down

0 comments on commit 8ecc723

Please sign in to comment.