Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscerie committed Nov 11, 2023
1 parent 807c4a8 commit 8f66ac0
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions selene-lib/src/lints/roblox_roact_dangling_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use full_moon::{
ast::{self, Ast},
visitors::Visitor,
};
use if_chain::if_chain;

pub struct RoactDanglingConnectionLint;

Expand Down Expand Up @@ -47,13 +46,9 @@ impl Lint for RoactDanglingConnectionLint {
.call_name_path
.last()
.and_then(|last_name| {
if ["Connect", "connect", "ConnectParallel", "Once"]
["Connect", "connect", "ConnectParallel", "Once"]
.contains(&last_name.as_str())
{
Some(function_call_stmt.call_prefix_range.0)
} else {
None
}
.then_some(function_call_stmt.call_prefix_range.0)
})
})
.collect(),
Expand Down Expand Up @@ -230,14 +225,12 @@ impl Visitor for RoactDanglingConnectionVisitor {

fn visit_local_assignment(&mut self, node: &ast::LocalAssignment) {
for (name, expr) in node.names().iter().zip(node.expressions().iter()) {
if_chain! {
if let ast::Expression::Value { value, .. } = expr;
if let ast::Value::Var(ast::Var::Expression(var_expr)) = &**value;
if is_roact_function(var_expr.prefix());
then {
self.definitions_of_roact_functions.insert(name.token().to_string());
if let ast::Expression::Var(ast::Var::Expression(var_expr)) = expr {
if is_roact_function(var_expr.prefix()) {
self.definitions_of_roact_functions
.insert(name.token().to_string());
}
};
}
}
}
}
Expand Down

0 comments on commit 8f66ac0

Please sign in to comment.