fix: clippy lints

This commit is contained in:
Amaan Qureshi 2024-11-16 03:20:59 -05:00
parent 78e5144f3f
commit 274e60a523
No known key found for this signature in database
GPG key ID: E67890ADC4227273
10 changed files with 17 additions and 22 deletions

View file

@ -208,7 +208,7 @@ fn populate_used_symbols(
// ensure that a subtree's symbol can be successfully reassigned to the word token
// without having to move the subtree to the heap.
// See https://github.com/tree-sitter/tree-sitter/issues/258
if syntax_grammar.word_token.map_or(false, |t| t.index == i) {
if syntax_grammar.word_token.is_some_and(|t| t.index == i) {
parse_table.symbols.insert(1, Symbol::terminal(i));
} else {
parse_table.symbols.push(Symbol::terminal(i));

View file

@ -363,9 +363,9 @@ impl CharacterSet {
}) {
Ok(ix) | Err(ix) => ix,
};
self.ranges.get(ix).map_or(false, |range| {
range.start <= seek_range.start && range.end >= seek_range.end
})
self.ranges
.get(ix)
.is_some_and(|range| range.start <= seek_range.start && range.end >= seek_range.end)
}
pub fn contains(&self, c: char) -> bool {

View file

@ -574,7 +574,7 @@ pub fn generate_node_types_json(
if node_type_json
.children
.as_ref()
.map_or(false, |c| c.types.is_empty())
.is_some_and(|c| c.types.is_empty())
{
node_type_json.children = None;
}

View file

@ -202,7 +202,7 @@ pub(crate) fn parse_grammar(input: &str) -> Result<InputGrammar> {
(&extra_symbols, &external_tokens),
name,
&mut in_progress,
) && grammar_json.word.as_ref().map_or(true, |w| w != name)
) && grammar_json.word.as_ref().is_some_and(|w| w != name)
{
grammar_json.conflicts.retain(|r| !r.contains(name));
grammar_json.supertypes.retain(|r| r != name);