Skip to content

Commit e495d6d

Browse files
committed
chore(lints): deny unused qualifications
Enable the Rust unused_qualifications lint across the workspace.
1 parent 4675b36 commit e495d6d

18 files changed

Lines changed: 39 additions & 36 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ similar = { version = "2.7.0", features = ["inline"] }
6767
hashbrown = "0.16.1"
6868

6969
# Lint configuration for the entire workspace
70+
[workspace.lints.rust]
71+
unused_qualifications = "deny"
72+
7073
[workspace.lints.clippy]
7174
# ==== Domain-Specific Allowances ====
7275
# These patterns are acceptable/necessary in parser/language-server projects

crates/emmylua_code_analysis/src/compilation/test/return_unwrap_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mod test {
3030
let mut ws = VirtualWorkspace::new_with_init_std_lib();
3131

3232
assert!(ws.has_no_diagnostic(
33-
crate::DiagnosticCode::ParamTypeMismatch,
33+
DiagnosticCode::ParamTypeMismatch,
3434
r#"
3535
---Converts hex to char
3636
---@param hex string

crates/emmylua_code_analysis/src/diagnostic/checker/assign_type_mismatch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn check_name_expr(
7575
value_type: LuaType,
7676
) -> Option<()> {
7777
let semantic_decl = semantic_model.find_decl(
78-
rowan::NodeOrToken::Node(name_expr.syntax().clone()),
78+
NodeOrToken::Node(name_expr.syntax().clone()),
7979
SemanticDeclLevel::default(),
8080
)?;
8181
let source_type = match semantic_decl.clone() {
@@ -116,7 +116,7 @@ fn check_name_expr(
116116
check_table_expr(
117117
context,
118118
semantic_model,
119-
rowan::NodeOrToken::Node(name_expr.syntax().clone()),
119+
NodeOrToken::Node(name_expr.syntax().clone()),
120120
&expr,
121121
source_type.as_ref(),
122122
);
@@ -152,7 +152,7 @@ fn check_index_expr(
152152
check_table_expr(
153153
context,
154154
semantic_model,
155-
rowan::NodeOrToken::Node(index_expr.syntax().clone()),
155+
NodeOrToken::Node(index_expr.syntax().clone()),
156156
&expr,
157157
source_type.as_ref(),
158158
);
@@ -195,7 +195,7 @@ fn check_local_stat(
195195
check_table_expr(
196196
context,
197197
semantic_model,
198-
rowan::NodeOrToken::Node(var.syntax().clone()),
198+
NodeOrToken::Node(var.syntax().clone()),
199199
expr,
200200
Some(&var_type),
201201
);

crates/emmylua_code_analysis/src/diagnostic/checker/return_type_mismatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn check_return_stat(
9494
check_table_expr(
9595
context,
9696
semantic_model,
97-
rowan::NodeOrToken::Node(return_expr.syntax().clone()),
97+
NodeOrToken::Node(return_expr.syntax().clone()),
9898
return_expr,
9999
Some(check_type),
100100
);
@@ -132,7 +132,7 @@ fn check_return_stat(
132132
if let Some(add_diagnostic) = check_table_expr(
133133
context,
134134
semantic_model,
135-
rowan::NodeOrToken::Node(return_expr.syntax().clone()),
135+
NodeOrToken::Node(return_expr.syntax().clone()),
136136
return_expr,
137137
Some(return_type),
138138
) && add_diagnostic

crates/emmylua_code_analysis/src/diagnostic/test/assign_type_mismatch_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ return t
11281128

11291129
#[test]
11301130
fn test_ref_index_key_match_tuple() {
1131-
let mut ws = crate::VirtualWorkspace::new();
1131+
let mut ws = VirtualWorkspace::new();
11321132

11331133
assert!(ws.has_no_diagnostic(
11341134
DiagnosticCode::AssignTypeMismatch,
@@ -1151,7 +1151,7 @@ return t
11511151

11521152
#[test]
11531153
fn test_ref_index_access_assign_class_to_object_mismatch() {
1154-
let mut ws = crate::VirtualWorkspace::new();
1154+
let mut ws = VirtualWorkspace::new();
11551155

11561156
assert!(!ws.has_no_diagnostic(
11571157
DiagnosticCode::AssignTypeMismatch,
@@ -1169,7 +1169,7 @@ return t
11691169

11701170
#[test]
11711171
fn test_ref_index_access_assign_object_to_class_mismatch() {
1172-
let mut ws = crate::VirtualWorkspace::new();
1172+
let mut ws = VirtualWorkspace::new();
11731173

11741174
assert!(!ws.has_no_diagnostic(
11751175
DiagnosticCode::AssignTypeMismatch,

crates/emmylua_code_analysis/src/semantic/generic/test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod test {
44

55
#[test]
66
fn test_variadic_func() {
7-
let mut ws = crate::VirtualWorkspace::new();
7+
let mut ws = VirtualWorkspace::new();
88
ws.def(
99
r#"
1010
---@generic T, R
@@ -32,7 +32,7 @@ mod test {
3232

3333
#[test]
3434
fn test_select_type() {
35-
let mut ws = crate::VirtualWorkspace::new_with_init_std_lib();
35+
let mut ws = VirtualWorkspace::new_with_init_std_lib();
3636
ws.def(
3737
r#"
3838
---@param ... string
@@ -89,7 +89,7 @@ mod test {
8989

9090
#[test]
9191
fn test_unpack() {
92-
let mut ws = crate::VirtualWorkspace::new_with_init_std_lib();
92+
let mut ws = VirtualWorkspace::new_with_init_std_lib();
9393

9494
ws.def(
9595
r#"
@@ -111,7 +111,7 @@ mod test {
111111

112112
#[test]
113113
fn test_return() {
114-
let mut ws = crate::VirtualWorkspace::new();
114+
let mut ws = VirtualWorkspace::new();
115115
ws.def(
116116
r#"
117117
---@class ab
@@ -210,7 +210,7 @@ result = {
210210

211211
#[test]
212212
fn test_call_generic() {
213-
let mut ws = crate::VirtualWorkspace::new();
213+
let mut ws = VirtualWorkspace::new();
214214
ws.def(
215215
r#"
216216
---@alias Warp<T> T
@@ -243,7 +243,7 @@ result = {
243243

244244
#[test]
245245
fn test_generic_alias_instantiation() {
246-
let mut ws = crate::VirtualWorkspace::new();
246+
let mut ws = VirtualWorkspace::new();
247247
ws.def(
248248
r#"
249249
---@alias Arrayable<T> T | T[]
@@ -274,7 +274,7 @@ result = {
274274

275275
#[test]
276276
fn test_generic_alias_instantiation2() {
277-
let mut ws = crate::VirtualWorkspace::new();
277+
let mut ws = VirtualWorkspace::new();
278278
ws.def(
279279
r#"
280280
---@alias Arrayable<T> T | T[]

crates/emmylua_code_analysis/src/semantic/infer/infer_index/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
},
2828
member::get_buildin_type_map_type_id,
2929
member::intersect_member_types,
30-
type_check::{self, check_type_compact},
30+
type_check::check_type_compact,
3131
},
3232
};
3333

@@ -957,7 +957,7 @@ fn infer_member_by_index_object(
957957
let expr = member_key.get_expr().ok_or(InferFailReason::None)?;
958958
let expr_type = infer_expr(db, cache, expr.clone())?;
959959
for (key, field) in access_member_type {
960-
if type_check::check_type_compact(db, key, &expr_type).is_ok() {
960+
if check_type_compact(db, key, &expr_type).is_ok() {
961961
return Ok(field.clone());
962962
}
963963
}

crates/emmylua_code_analysis/src/semantic/infer/infer_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn infer_table_expr(
2626
return infer_table_tuple_or_array(db, cache, table);
2727
}
2828

29-
Ok(LuaType::TableConst(crate::InFiled {
29+
Ok(LuaType::TableConst(InFiled {
3030
file_id: cache.get_file_id(),
3131
value: table.get_range(),
3232
}))

crates/emmylua_code_analysis/src/semantic/infer/narrow/condition_flow/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl PendingConditionNarrow {
159159
InferConditionFlow::TrueCondition => LuaType::from_vec(result),
160160
InferConditionFlow::FalseCondition => {
161161
let target = LuaType::from_vec(result);
162-
crate::TypeOps::Remove.apply(db, &antecedent_type, &target)
162+
TypeOps::Remove.apply(db, &antecedent_type, &target)
163163
}
164164
}
165165
}
@@ -222,15 +222,15 @@ impl PendingConditionNarrow {
222222
} => match condition_flow.clone() {
223223
InferConditionFlow::TrueCondition => {
224224
let maybe_type =
225-
crate::TypeOps::Intersect.apply(db, &antecedent_type, right_expr_type);
225+
TypeOps::Intersect.apply(db, &antecedent_type, right_expr_type);
226226
if maybe_type.is_never() {
227227
antecedent_type
228228
} else {
229229
maybe_type
230230
}
231231
}
232232
InferConditionFlow::FalseCondition => {
233-
crate::TypeOps::Remove.apply(db, &antecedent_type, right_expr_type)
233+
TypeOps::Remove.apply(db, &antecedent_type, right_expr_type)
234234
}
235235
},
236236
PendingConditionNarrow::TypeGuard {
@@ -242,7 +242,7 @@ impl PendingConditionNarrow {
242242
.unwrap_or_else(|| narrow.clone())
243243
}
244244
InferConditionFlow::FalseCondition => {
245-
crate::TypeOps::Remove.apply(db, &antecedent_type, narrow)
245+
TypeOps::Remove.apply(db, &antecedent_type, narrow)
246246
}
247247
},
248248
PendingConditionNarrow::Correlated(correlated_narrowing) => {

crates/emmylua_code_analysis/src/vfs/collect_workspace_files.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl WorkspaceFileMatcher {
253253
build_workspace_file_matcher(&workspace_folders, emmyrc, None, None)
254254
}
255255

256-
pub fn is_match(&self, path: &std::path::Path) -> bool {
256+
pub fn is_match(&self, path: &Path) -> bool {
257257
let include_set = match wax::any(self.include.iter().map(|s| s.as_str())) {
258258
Ok(include_set) => include_set,
259259
Err(_) => {

0 commit comments

Comments
 (0)