Skip to content

Commit 5dc5d66

Browse files
committed
fix review
1 parent df64825 commit 5dc5d66

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

crates/emmylua_code_analysis/src/compilation/analyzer/lua/closure.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ fn analyze_return(
163163

164164
signature.resolve_return = SignatureReturnStatus::InferResolve;
165165

166-
if returns.len() == 1 && returns[0].type_ref.is_nil() {
167-
} else {
168-
signature.return_docs = returns;
169-
}
166+
signature.return_docs = returns;
170167

171168
Some(())
172169
}

crates/emmylua_code_analysis/src/db_index/type/humanize_type.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,15 @@ fn humanize_simple_type(
166166
}
167167

168168
fn humanize_union_type(db: &DbIndex, union: &LuaUnionType, level: RenderLevel) -> String {
169-
format_union_type(
170-
union,
171-
level,
172-
|ty, level| humanize_type(db, ty, level.next_level()),
173-
true,
174-
)
169+
format_union_type(union, level, |ty, level| {
170+
humanize_type(db, ty, level.next_level())
171+
})
175172
}
176173

177174
pub fn format_union_type<F>(
178175
union: &LuaUnionType,
179176
level: RenderLevel,
180177
mut type_formatter: F,
181-
is_hover: bool,
182178
) -> String
183179
where
184180
F: FnMut(&LuaType, RenderLevel) -> String,
@@ -199,7 +195,7 @@ where
199195
let mut has_nil = false;
200196
let mut has_function = false;
201197
for ty in types.iter() {
202-
if (!is_hover && !ty.is_function() && ty.is_nil()) || (is_hover && ty.is_nil()) {
198+
if ty.is_nil() {
203199
has_nil = true;
204200
continue;
205201
} else if ty.is_function() {

crates/emmylua_ls/src/handlers/hover/hover_humanize.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,9 @@ fn hover_union_type(
485485
union: &LuaUnionType,
486486
level: RenderLevel,
487487
) -> String {
488-
format_union_type(
489-
union,
490-
level,
491-
|ty, level| hover_type(builder, ty, Some(level)),
492-
true,
493-
)
488+
format_union_type(union, level, |ty, level| {
489+
hover_type(builder, ty, Some(level))
490+
})
494491
}
495492

496493
fn hover_multi_line_union_type(

0 commit comments

Comments
 (0)