10098: minor: dead code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2021-08-31 12:27:27 +00:00 committed by GitHub
commit 4786a22787
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 34 deletions

View File

@ -666,42 +666,22 @@ pub fn to_fragment_kind(call: &ast::MacroCall) -> FragmentKind {
};
match parent.kind() {
MACRO_ITEMS | SOURCE_FILE => FragmentKind::Items,
MACRO_STMTS => FragmentKind::Statements,
MACRO_ITEMS | SOURCE_FILE | ITEM_LIST => FragmentKind::Items,
MACRO_STMTS | EXPR_STMT | BLOCK_EXPR => FragmentKind::Statements,
MACRO_PAT => FragmentKind::Pattern,
MACRO_TYPE => FragmentKind::Type,
ITEM_LIST => FragmentKind::Items,
ARG_LIST | TRY_EXPR | TUPLE_EXPR | PAREN_EXPR | ARRAY_EXPR | FOR_EXPR | PATH_EXPR
| CLOSURE_EXPR | CONDITION | BREAK_EXPR | RETURN_EXPR | MATCH_EXPR | MATCH_ARM
| MATCH_GUARD | RECORD_EXPR_FIELD | CALL_EXPR | INDEX_EXPR | METHOD_CALL_EXPR
| FIELD_EXPR | AWAIT_EXPR | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR => {
FragmentKind::Expr
}
LET_STMT => {
// FIXME: Handle LHS Pattern
FragmentKind::Expr
}
EXPR_STMT => FragmentKind::Statements,
BLOCK_EXPR => FragmentKind::Statements,
ARG_LIST => FragmentKind::Expr,
TRY_EXPR => FragmentKind::Expr,
TUPLE_EXPR => FragmentKind::Expr,
PAREN_EXPR => FragmentKind::Expr,
ARRAY_EXPR => FragmentKind::Expr,
FOR_EXPR => FragmentKind::Expr,
PATH_EXPR => FragmentKind::Expr,
CLOSURE_EXPR => FragmentKind::Expr,
CONDITION => FragmentKind::Expr,
BREAK_EXPR => FragmentKind::Expr,
RETURN_EXPR => FragmentKind::Expr,
MATCH_EXPR => FragmentKind::Expr,
MATCH_ARM => FragmentKind::Expr,
MATCH_GUARD => FragmentKind::Expr,
RECORD_EXPR_FIELD => FragmentKind::Expr,
CALL_EXPR => FragmentKind::Expr,
INDEX_EXPR => FragmentKind::Expr,
METHOD_CALL_EXPR => FragmentKind::Expr,
FIELD_EXPR => FragmentKind::Expr,
AWAIT_EXPR => FragmentKind::Expr,
CAST_EXPR => FragmentKind::Expr,
REF_EXPR => FragmentKind::Expr,
PREFIX_EXPR => FragmentKind::Expr,
RANGE_EXPR => FragmentKind::Expr,
BIN_EXPR => FragmentKind::Expr,
_ => {
// Unknown , Just guess it is `Items`
FragmentKind::Items

View File

@ -277,8 +277,6 @@ pub fn as_debug_string(&self) -> String {
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum ExpansionError {
IOError(String),
JsonError(String),
Unknown(String),
ExpansionError(String),
}
@ -286,8 +284,6 @@ pub enum ExpansionError {
impl fmt::Display for ExpansionError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ExpansionError::IOError(e) => write!(f, "I/O error: {}", e),
ExpansionError::JsonError(e) => write!(f, "JSON decoding error: {}", e),
ExpansionError::Unknown(e) => e.fmt(f),
ExpansionError::ExpansionError(e) => write!(f, "proc macro returned error: {}", e),
}