Skip to content

Commit 06f27c2

Browse files
committed
clean code
1 parent 42609d8 commit 06f27c2

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

crates/emmylua_code_analysis/resources/std/debug.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function debug.gethook(thread) end
9696
--- information about the `print` function.
9797
---@overload fun(f: int|function, what?: debuglib.InfoWhat):debuglib.DebugInfo
9898
---@param thread thread
99-
---@param f integer|async fun(...):any...
99+
---@param f integer|function
100100
---@param what? debuglib.InfoWhat
101101
---@return debuglib.DebugInfo
102102
---@nodiscard
@@ -175,7 +175,7 @@ function debug.getregistry() end
175175
---
176176
--- Variable names starting with '(' (open parenthesis) represent variables with
177177
--- no known names (variables from chunks saved without debug information).
178-
---@param f async fun(...):any...
178+
---@param f function
179179
---@param up integer
180180
---@return string name
181181
---@return any value

crates/emmylua_code_analysis/resources/std/global.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ function select(index, ...) end
371371
---
372372
--- This function returns `table`.
373373
---@param table table
374-
---@param metatable? std.metatable|table
374+
---@param metatable std.metatable|table
375375
---@return table
376376
function setmetatable(table, metatable) end
377377

crates/emmylua_code_analysis/resources/std/string.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ function string.lower(s) end
222222
---@param s string
223223
---@param pattern string
224224
---@param init? integer
225-
---@return any...
225+
---@return string...
226226
function string.match(s, pattern, init) end
227227

228228
---@version >5.3

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ fn is_valid_member(
130130
index_key: &LuaIndexKey,
131131
code: DiagnosticCode,
132132
) -> Option<()> {
133-
// dbg!(semantic_model.get_semantic_info(index_expr.syntax().clone().into()));
134133
// 检查 member_info
135134
let need_add_diagnostic =
136135
match semantic_model.get_semantic_info(index_expr.syntax().clone().into()) {
@@ -213,7 +212,10 @@ fn is_valid_member(
213212
match &info.key {
214213
LuaMemberKey::Expr(typ) => {
215214
if typ.is_string() {
216-
if key_type_set.iter().any(|typ| typ.is_string() || typ.is_str_tpl_ref()) {
215+
if key_type_set
216+
.iter()
217+
.any(|typ| typ.is_string() || typ.is_str_tpl_ref())
218+
{
217219
return Some(());
218220
}
219221
} else if typ.is_integer() {
@@ -223,7 +225,10 @@ fn is_valid_member(
223225
}
224226
}
225227
LuaMemberKey::Name(_) => {
226-
if key_type_set.iter().any(|typ| typ.is_string() || typ.is_str_tpl_ref()) {
228+
if key_type_set
229+
.iter()
230+
.any(|typ| typ.is_string() || typ.is_str_tpl_ref())
231+
{
227232
return Some(());
228233
}
229234
}

crates/emmylua_code_analysis/src/semantic/type_check/simple_type.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ pub fn check_simple_type_compact(
6565
}
6666
}
6767
LuaType::String | LuaType::StringConst(_) => match compact_type {
68-
LuaType::String | LuaType::StringConst(_) | LuaType::DocStringConst(_) | LuaType::StrTplRef(_) => {
68+
LuaType::String
69+
| LuaType::StringConst(_)
70+
| LuaType::DocStringConst(_)
71+
| LuaType::StrTplRef(_) => {
6972
return Ok(());
7073
}
7174
LuaType::Ref(_) => {

0 commit comments

Comments
 (0)