minor: Remove unused code

This commit is contained in:
Lukas Wirth 2022-05-31 20:21:50 +02:00
parent 0327df224b
commit 1234d8647f
2 changed files with 0 additions and 18 deletions

View File

@ -383,7 +383,6 @@ pub(crate) fn after_if(&self) -> bool {
// FIXME: This shouldn't exist
pub(crate) fn is_path_disallowed(&self) -> bool {
!self.qualifier_ctx.none()
|| matches!(self.prev_sibling, Some(ImmediatePrevSibling::Visibility))
|| (matches!(self.name_ctx(), Some(NameContext { .. })) && self.pattern_ctx.is_none())
|| matches!(self.pattern_ctx, Some(PatternContext { record_pat: Some(_), .. }))
|| matches!(

View File

@ -23,7 +23,6 @@ pub(crate) enum ImmediatePrevSibling {
IfExpr,
TraitDefName,
ImplDefType,
Visibility,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@ -77,17 +76,6 @@ pub(crate) fn determine_prev_sibling(name_like: &ast::NameLike) -> Option<Immedi
_ => node,
};
let prev_sibling = non_trivia_sibling(node.into(), Direction::Prev)?.into_node()?;
if prev_sibling.kind() == ERROR {
let prev_sibling = prev_sibling.first_child()?;
let res = match_ast! {
match prev_sibling {
// vis followed by random ident will always error the parser
ast::Visibility(_) => ImmediatePrevSibling::Visibility,
_ => return None,
}
};
return Some(res);
}
let res = match_ast! {
match prev_sibling {
ast::ExprStmt(it) => {
@ -442,9 +430,4 @@ fn test_if_expr_prev_sibling() {
check_prev_sibling(r"fn foo() { if true {} w$0", ImmediatePrevSibling::IfExpr);
check_prev_sibling(r"fn foo() { if true {}; w$0", None);
}
#[test]
fn test_vis_prev_sibling() {
check_prev_sibling(r"pub w$0", ImmediatePrevSibling::Visibility);
}
}