summaryrefslogtreecommitdiff
path: root/xmake/modules/package/manager/cargo/install_package.lua
diff options
context:
space:
mode:
authorw568w <[email protected]>2023-08-09 11:06:06 +0800
committerw568w <[email protected]>2023-08-09 11:06:06 +0800
commitb156158b59dd2ed5cd825d6ac98b5222c75d19fd (patch)
tree78d004dde19d9fa937f6e2219bf50db88dc6d1fa /xmake/modules/package/manager/cargo/install_package.lua
parent0b82a790bad9538e09102afc31fc29c1e9bac826 (diff)
fix local function style and extract the target check function
Diffstat (limited to 'xmake/modules/package/manager/cargo/install_package.lua')
-rw-r--r--xmake/modules/package/manager/cargo/install_package.lua7
1 files changed, 2 insertions, 5 deletions
diff --git a/xmake/modules/package/manager/cargo/install_package.lua b/xmake/modules/package/manager/cargo/install_package.lua
index 7d58553e6..9daa665cd 100644
--- a/xmake/modules/package/manager/cargo/install_package.lua
+++ b/xmake/modules/package/manager/cargo/install_package.lua
@@ -22,6 +22,7 @@
import("core.base.option")
import("core.project.config")
import("lib.detect.find_tool")
+import("private.tools.rust.check_target")
-- install package
--
@@ -55,11 +56,7 @@ function main(name, opt)
-- get target
-- e.g. x86_64-pc-windows-msvc, aarch64-unknown-none
-- @see https://github.com/xmake-io/xmake/issues/4049
- local target
- local arch = opt.arch
- if arch and #arch:split("%-") > 1 then
- target = arch
- end
+ local target = check_target(opt.arch, true) and opt.arch or nil
-- generate Cargo.toml
local sourcedir = path.join(opt.cachedir, "source")