Skip to content

Commit

Permalink
refactor: rename misleading variables
Browse files Browse the repository at this point in the history
  • Loading branch information
saecki committed Jun 30, 2024
1 parent 96c4e29 commit 9eac2f4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lua/crates/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function M.open_homepage()
local crates = util.get_line_crates(buf, Span.pos(line))
local _, crate = next(crates)
if crate then
local crate_info = state.api_cache[crate:package()]
if crate_info and crate_info.homepage then
util.open_url(crate_info.homepage)
local api_crate = state.api_cache[crate:package()]
if api_crate and api_crate.homepage then
util.open_url(api_crate.homepage)
else
util.notify(vim.log.levels.INFO, "The crate '%s' has no homepage specified", crate:package())
end
Expand All @@ -129,9 +129,9 @@ function M.open_repository()
local crates = util.get_line_crates(buf, Span.pos(line))
local _, crate = next(crates)
if crate then
local crate_info = state.api_cache[crate:package()]
if crate_info and crate_info.repository then
util.open_url(crate_info.repository)
local api_crate = state.api_cache[crate:package()]
if api_crate and api_crate.repository then
util.open_url(api_crate.repository)
else
util.notify(vim.log.levels.INFO, "The crate '%s' has no repository specified", crate:package())
end
Expand All @@ -144,8 +144,8 @@ function M.open_documentation()
local crates = util.get_line_crates(buf, Span.pos(line))
local _, crate = next(crates)
if crate then
local crate_info = state.api_cache[crate:package()]
local url = crate_info and crate_info.documentation
local api_crate = state.api_cache[crate:package()]
local url = api_crate and api_crate.documentation
url = url or util.docs_rs_url(crate:package())
util.open_url(url)
end
Expand Down

0 comments on commit 9eac2f4

Please sign in to comment.