style: prefer turbofish syntax where possible
This commit is contained in:
parent
fd91404ab0
commit
b40839cd72
12 changed files with 28 additions and 29 deletions
|
|
@ -26,7 +26,7 @@ pub fn build_lex_table(
|
|||
LexTable::default()
|
||||
};
|
||||
|
||||
let mut parse_state_ids_by_token_set: Vec<(TokenSet, Vec<ParseStateId>)> = Vec::new();
|
||||
let mut parse_state_ids_by_token_set = Vec::<(TokenSet, Vec<ParseStateId>)>::new();
|
||||
for (i, state) in parse_table.states.iter().enumerate() {
|
||||
let tokens = state
|
||||
.terminal_entries
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ impl<'a> ParseTableBuilder<'a> {
|
|||
// REDUCE-REDUCE conflicts where all actions have the *same*
|
||||
// precedence, and there can still be SHIFT/REDUCE conflicts.
|
||||
let mut considered_associativity = false;
|
||||
let mut shift_precedence: Vec<(&Precedence, Symbol)> = Vec::new();
|
||||
let mut shift_precedence = Vec::<(&Precedence, Symbol)>::new();
|
||||
let mut conflicting_items = HashSet::new();
|
||||
for (item, lookaheads) in &item_set.entries {
|
||||
if let Some(step) = item.step() {
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ impl<'a> NfaCursor<'a> {
|
|||
fn group_transitions<'b>(
|
||||
iter: impl Iterator<Item = (&'b CharacterSet, bool, i32, u32)>,
|
||||
) -> Vec<NfaTransition> {
|
||||
let mut result: Vec<NfaTransition> = Vec::new();
|
||||
let mut result = Vec::<NfaTransition>::new();
|
||||
for (chars, is_sep, prec, state) in iter {
|
||||
let mut chars = chars.clone();
|
||||
let mut i = 0;
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ pub(super) fn extract_tokens(
|
|||
.expected_conflicts
|
||||
.into_iter()
|
||||
.map(|conflict| {
|
||||
let mut result: Vec<_> = conflict
|
||||
let mut result = conflict
|
||||
.iter()
|
||||
.map(|symbol| symbol_replacer.replace_symbol(*symbol))
|
||||
.collect();
|
||||
.collect::<Vec<_>>();
|
||||
result.sort_unstable();
|
||||
result.dedup();
|
||||
result
|
||||
|
|
|
|||
|
|
@ -362,10 +362,10 @@ mod tests {
|
|||
|
||||
let inline_map = process_inlines(&grammar, &LexicalGrammar::default()).unwrap();
|
||||
|
||||
let productions: Vec<&Production> = inline_map
|
||||
let productions = inline_map
|
||||
.inlined_productions(&grammar.variables[0].productions[0], 1)
|
||||
.unwrap()
|
||||
.collect();
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert_eq!(
|
||||
productions.iter().copied().cloned().collect::<Vec<_>>(),
|
||||
|
|
@ -461,10 +461,10 @@ mod tests {
|
|||
|
||||
let inline_map = process_inlines(&grammar, &LexicalGrammar::default()).unwrap();
|
||||
|
||||
let productions: Vec<_> = inline_map
|
||||
let productions = inline_map
|
||||
.inlined_productions(&grammar.variables[0].productions[0], 0)
|
||||
.unwrap()
|
||||
.collect();
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert_eq!(
|
||||
productions.iter().copied().cloned().collect::<Vec<_>>(),
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ impl Generator {
|
|||
|
||||
// For each lex state, compute a summary of the code that needs to be
|
||||
// generated.
|
||||
let state_transition_summaries: Vec<Vec<TransitionSummary>> = lex_table
|
||||
let state_transition_summaries = lex_table
|
||||
.states
|
||||
.iter()
|
||||
.map(|state| {
|
||||
|
|
@ -732,7 +732,7 @@ impl Generator {
|
|||
})
|
||||
.collect()
|
||||
})
|
||||
.collect();
|
||||
.collect::<Vec<Vec<_>>>();
|
||||
|
||||
// Generate a helper function for each large character set.
|
||||
let mut sorted_large_char_sets = large_character_sets.iter().collect::<Vec<_>>();
|
||||
|
|
@ -1153,7 +1153,7 @@ impl Generator {
|
|||
|
||||
let mut index = 0;
|
||||
let mut small_state_indices = Vec::new();
|
||||
let mut symbols_by_value: HashMap<(usize, SymbolType), Vec<Symbol>> = HashMap::new();
|
||||
let mut symbols_by_value = HashMap::<(usize, SymbolType), Vec<Symbol>>::new();
|
||||
for state in self.parse_table.states.iter().skip(self.large_state_count) {
|
||||
small_state_indices.push(index);
|
||||
symbols_by_value.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue