aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2022-10-22 12:36:38 +0200
committerdundargoc <gocdundar@gmail.com>2022-11-06 11:44:10 +0100
commit731cdde28ea8d48cc23ba2752a08c261c87eee92 (patch)
tree92e814050fdbca64aca435f03975b6d5678fbdf3 /src/nvim/api
parenta79d28e4d7939c13f38cf4ce63ff240011bca96d (diff)
downloadrneovim-731cdde28ea8d48cc23ba2752a08c261c87eee92.tar.gz
rneovim-731cdde28ea8d48cc23ba2752a08c261c87eee92.tar.bz2
rneovim-731cdde28ea8d48cc23ba2752a08c261c87eee92.zip
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.
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/extmark.c3
-rw-r--r--src/nvim/api/tabpage.c13
-rw-r--r--src/nvim/api/vimscript.c2
3 files changed, 8 insertions, 10 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 3b1b470629..fee6876469 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -833,9 +833,8 @@ uint32_t src2ns(Integer *src_id)
}
if (*src_id < 0) {
return (((uint32_t)1) << 31) - 1;
- } else {
- return (uint32_t)(*src_id);
}
+ return (uint32_t)(*src_id);
}
/// Adds a highlight to buffer.
diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c
index b81fc3b7d7..31f9fab82a 100644
--- a/src/nvim/api/tabpage.c
+++ b/src/nvim/api/tabpage.c
@@ -110,15 +110,14 @@ Window nvim_tabpage_get_win(Tabpage tabpage, Error *err)
if (tab == curtab) {
return nvim_get_current_win();
- } else {
- FOR_ALL_WINDOWS_IN_TAB(wp, tab) {
- if (wp == tab->tp_curwin) {
- return wp->handle;
- }
+ }
+ FOR_ALL_WINDOWS_IN_TAB(wp, tab) {
+ if (wp == tab->tp_curwin) {
+ return wp->handle;
}
- // There should always be a current window for a tabpage
- abort();
}
+ // There should always be a current window for a tabpage
+ abort();
}
/// Gets the tabpage number
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c
index 71209c9ab6..dccc2d42d8 100644
--- a/src/nvim/api/vimscript.c
+++ b/src/nvim/api/vimscript.c
@@ -532,7 +532,7 @@ Dictionary nvim_parse_expression(String expr, String flags, Boolean highlight, E
kv_drop(ast_conv_stack, 1);
} else {
if (cur_item.ret_node_p->type == kObjectTypeNil) {
- size_t items_size = (size_t)(3 // "type", "start" and "len"
+ size_t items_size = (size_t)(3 // "type", "start" and "len" // NOLINT(bugprone-misplaced-widening-cast)
+ (node->children != NULL) // "children"
+ (node->type == kExprNodeOption
|| node->type == kExprNodePlainIdentifier) // "scope"