Skip to content

Commit

Permalink
ref: utils.has -> vim.tbl_contains
Browse files Browse the repository at this point in the history
  • Loading branch information
Iron-E committed Mar 31, 2023
1 parent 0bdf779 commit 983c4b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 3 additions & 2 deletions lua/barbar/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local get_current_buf = vim.api.nvim_get_current_buf --- @type function
local list_bufs = vim.api.nvim_list_bufs --- @type function
local list_extend = vim.list_extend
local severity = vim.diagnostic.severity --- @type {[integer]: string, [string]: integer}
local tbl_contains = vim.tbl_contains
local tbl_filter = vim.tbl_filter

local Buffer = require'barbar.buffer'
Expand Down Expand Up @@ -116,10 +117,10 @@ function state.get_buffer_list()

for _, bufnr in ipairs(list_bufs()) do
if buf_get_option(bufnr, 'buflisted') and
not utils.has(exclude_ft, buf_get_option(bufnr, 'filetype'))
not tbl_contains(exclude_ft, buf_get_option(bufnr, 'filetype'))
then
local name = buf_get_name(bufnr)
if not utils.has(exclude_name, utils.basename(name, hide_extensions)) then
if not tbl_contains(exclude_name, utils.basename(name, hide_extensions)) then
table_insert(result, bufnr)
end
end
Expand Down
9 changes: 0 additions & 9 deletions lua/barbar/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@ local utils = {
notify_once_util(name .. ' is deprecated. Use ' .. alternative .. 'instead.', vim.log.levels.WARN)
end,

--- Return whether element `n` is in a `list.
--- @generic T
--- @param list T[]
--- @param t T
--- @return boolean
has = function(list, t)
return index_of(list, t) ~= nil
end,

--- utilities for working with highlight groups.
--- @class barbar.utils.hl
hl = {
Expand Down

0 comments on commit 983c4b4

Please sign in to comment.