Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscerie committed Nov 11, 2023
1 parent 6a2ae8b commit 40cc2e8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions selene-lib/src/lints/roblox_roact_non_exhaustive_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ fn get_formatted_error_message(
missing_or_unnecessary: &str,
) -> String {
format!(
"react hook {} has {}: {}",
"react hook {} has {} {}: {}",
hook_name,
missing_or_unnecessary,
if missing_dependencies.len() == 1 {
format!("{} dependency", missing_or_unnecessary)
"dependency"
} else {
format!("{} dependencies", missing_or_unnecessary)
"dependencies"
},
match missing_dependencies.len() {
1 => format!("'{}'", missing_dependencies[0].indexing_expression_name()),
Expand Down Expand Up @@ -511,11 +512,8 @@ impl Visitor for RoactMissingDependencyVisitor<'_> {
.iter()
.filter_map(|(_, dependency)| {
if let Some(resolved_start) = dependency.resolved_start_range {
if self.is_byte_outside_enclosing_named_fn(resolved_start) {
Some(dependency.clone())
} else {
None
}
self.is_byte_outside_enclosing_named_fn(resolved_start)
.then_some(dependency.clone())
} else {
// Assume unresolved variables are globals and should not be included in deps
Some(dependency.clone())
Expand Down

0 comments on commit 40cc2e8

Please sign in to comment.