Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a777a53

Browse files
committed
(parser) fix: return_and_then lint
1 parent 3fa6d5c commit a777a53

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

src/parser/modifiers/functions.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ impl MakeFunction for Ast {
3939
child.can_make_function().map(|depth| depth + 1),
4040
Self::FunctionArgsBuild(vec)
4141
| Self::ListInitialiser(ListInitialiser { elts: vec, .. })
42-
| Self::BracedBlock(BracedBlock { elts: vec, .. }) => vec
43-
.last()
44-
.and_then(|last| last.can_make_function().map(|depth| depth + 1)),
45-
Self::ControlFlow(ctrl) => ctrl
46-
.as_ast()
47-
.and_then(|last| last.can_make_function().map(|depth| depth + 1)),
42+
| Self::BracedBlock(BracedBlock { elts: vec, .. }) =>
43+
vec.last()?.can_make_function().map(|depth| depth + 1),
44+
Self::ControlFlow(ctrl) => ctrl.as_ast()?.can_make_function().map(|depth| depth + 1),
4845
}
4946
}
5047

src/parser/symbols/sort_symbols.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,7 @@ pub fn handle_one_symbol(symbol: Symbol, current: &mut Ast) -> Result<Option<Tod
131131
// blocks
132132
SymbolParsing::BracedBlock(block) => return Ok(Some(block)),
133133
// special
134-
SymbolParsing::Interrogation => current.push_op(TernaryOperator)?, /* ternary (only */
135-
// ternary because
136-
// trigraphs are
137-
// ignored, and colon
138-
// is sorted in main
139-
// function in
140-
// mod.rs)
134+
SymbolParsing::Interrogation => current.push_op(TernaryOperator)?, /* ternary only because trigraphis are ignored, and colon is handled in the main function in mod.rs */
141135
SymbolParsing::Colon => handle_colon(current)?,
142136
SymbolParsing::Comma => handle_comma(current)?,
143137
}

0 commit comments

Comments
 (0)