refactor: fix clang-tidy warnings

Enable and fix bugprone-misplaced-widening-cast warning.

Fix some modernize-macro-to-enum and readability-else-after-return
warnings, but don't enable them. While the warnings can be useful, they
are in general too noisy to enable.
This commit is contained in:
dundargoc
2022-10-22 12:36:38 +02:00
parent a79d28e4d7
commit 731cdde28e
56 changed files with 558 additions and 555 deletions

View File

@@ -906,9 +906,8 @@ Float nlua_pop_Float(lua_State *lstate, Error *err)
lua_pop(lstate, 1);
if (table_props.type != kObjectTypeFloat) {
return 0;
} else {
return (Float)table_props.val;
}
return (Float)table_props.val;
}
/// Convert lua table to array without determining whether it is array

View File

@@ -378,15 +378,14 @@ int nlua_setvar(lua_State *lstate)
if (di == NULL) {
// Doesn't exist, nothing to do
return 0;
} else {
// Notify watchers
if (watched) {
tv_dict_watcher_notify(dict, key.data, NULL, &di->di_tv);
}
// Delete the entry
tv_dict_item_remove(dict, di);
}
// Notify watchers
if (watched) {
tv_dict_watcher_notify(dict, key.data, NULL, &di->di_tv);
}
// Delete the entry
tv_dict_item_remove(dict, di);
} else {
// Update the key
typval_T tv;