Skip to content

Commit a4c93d6

Browse files
committed
clippy pedantic
1 parent c2ee4e4 commit a4c93d6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/identbimap/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl IdentBiMap {
180180
self.insert_data_or_qi2(&parse::OrQi2::from(what_to_fill), &conversion_table);
181181
if let parse::OrQi2::NotQi2(ident) = what_to_fill {
182182
let ascii = self.0.bimap_get_by_left(&ident).unwrap().clone();
183-
self.0.insert(ident.clone(), ascii.clone(), Some(Type::Mutable));
183+
self.0.insert(ident.clone(), ascii, Some(Type::Mutable));
184184
}
185185
self.insert_dats(&elems, &conversion_table);
186186
}
@@ -210,7 +210,7 @@ impl IdentBiMap {
210210
} => {
211211
self.insert_ident(&ident, &conversion_table);
212212
let ascii = self.0.bimap_get_by_left(&ident).unwrap().clone();
213-
self.0.insert(ident.clone(), ascii.clone(), Some(Type::Mutable));
213+
self.0.insert(ident.clone(), ascii, Some(Type::Mutable));
214214
self.insert_rvalue(rvalue, &conversion_table)
215215
}
216216
Assignment {
@@ -219,7 +219,7 @@ impl IdentBiMap {
219219
} => {
220220
self.insert_ident(&ident, &conversion_table);
221221
let ascii = self.0.bimap_get_by_left(&ident).unwrap().clone();
222-
self.0.insert(ident.clone(), ascii.clone(), Some(Type::Mutable));
222+
self.0.insert(ident.clone(), ascii, Some(Type::Mutable));
223223
self.insert_ident(&index, &conversion_table);
224224
self.insert_rvalue(rvalue, &conversion_table)
225225
}

src/parse/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ struct IfStmtAfterZhe3 {
550550
}
551551

552552
impl IfStmtAfterZhe3 {
553-
pub fn to_stmt_with_cond(self, cond: IfCond) -> Statement {
553+
pub fn into_stmt_with_cond(self, cond: IfCond) -> Statement {
554554
let IfStmtAfterZhe3 {
555555
ifstmts,
556556
elseifcases,
@@ -629,7 +629,8 @@ fn parse_unary_if_expression(mut iter: &mut LexIter<'_>) -> Result<UnaryIfExpr,
629629
// either `data` or `(IDENTIFIER '之'('長'|STRING_LITERAL|IDENTIFIER))`
630630
if let Some(lex::Lex::Zhi1) = iter.peek_nth(1) {
631631
iter.next(); // Identifier(i)
632-
let res = parse_optional_indexer(&mut iter, Data::Identifier(Identifier(i.to_string())))?;
632+
let res =
633+
parse_optional_indexer(&mut iter, Data::Identifier(Identifier(i.to_string())))?;
633634
Ok(UnaryIfExpr::Complex(res))
634635
} else {
635636
let data2 = parse_data_or_qi2(&mut iter)?;
@@ -735,10 +736,10 @@ fn parse_statement(mut iter: &mut LexIter<'_>) -> Result<Statement, Error> {
735736
lex::Lex::Xian2 => parse_arraycat_after_xian2(&mut iter),
736737
lex::Lex::Chong1 => parse_arraypush_after_chong1(&mut iter),
737738
lex::Lex::Ruo4Qi2Bu4Ran2Zhe3 => {
738-
Ok(parse_if_statement_after_zhe3(&mut iter)?.to_stmt_with_cond(IfCond::NotQi2))
739+
Ok(parse_if_statement_after_zhe3(&mut iter)?.into_stmt_with_cond(IfCond::NotQi2))
739740
}
740741
lex::Lex::Ruo4Qi2Ran2Zhe3 => Ok(parse_if_statement_after_zhe3(&mut iter)?
741-
.to_stmt_with_cond(IfCond::Unary(UnaryIfExpr::Simple(OrQi2::Qi2)))),
742+
.into_stmt_with_cond(IfCond::Unary(UnaryIfExpr::Simple(OrQi2::Qi2)))),
742743
lex::Lex::Ruo4 => {
743744
// if_statement : '若' if_expression '者' statement+ ('或若' if_expression '者' statement+)* ('若非' statement+)? FOR_IF_END ;
744745
let ifexpr = parse_ifexpression_plus_zhe3(&mut iter)?;

0 commit comments

Comments
 (0)