Repository navigation
fix(rust-core): 修复 Rust 1.100 clippy 新增的 lint,并固定 Rust 1.100.0 工具链 - #51
Merged
Merged
Conversation
10 of 13 tasks
xiaoyumuxi
marked this pull request as ready for review
November 15, 2026 05:46
- 仓库根目录新增 rust-toolchain.toml,本地和 CI 都使用 1.100.0。 - rust-core.yml、plugins-verify.yml 的 dtolnay/rust-toolchain 从 @stable 改为 @1.100.0,与固定文件写同一个版本字符串;SDK 的 @1.87 和 cargo +1.87 保持不变。 - rust-toolchain.toml 加入 affected-crates.mjs 的 EVERY_CRATE,改动它会 选中全部 crate。 - CONTRIBUTING.md 新增“工具链 / Toolchain”一节,说明安装方式、额外目标 和升级步骤;shared/plugins/README.md 的 SDK 检查说明不再写 stable。
11 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
#50 合入后,
Rust Core工作流第一次检查全部 crate,Linux 作业在 Lint 一步失败(run 43681201096)。原因是 CI 的stable工具链已经是 Rust 1.100.0,它的 clippy 新增或加强了几条 lint,命中了 7 处现有代码。这些代码以前没有 CI 跑过 clippy,所以一直没人发现。本 PR 做两件事:
rust-toolchain.toml把 Rust 固定到 1.100.0,以后新版本 clippy 新增的 lint 只会在主动升级时出现,不会让无关的 PR 失败。改动一:修复 clippy 1.100 的 lint
toolchain/src/paths.rsquestion_markstrip_prefix("//")?要求它是 UNC 路径,去掉了多余的else { return None }project-generators/src/archive.rsif守卫返回布尔字面量real_directory改成一个布尔表达式;Windows reparse point 判断拆成reparse_point,cfg只留在调用MetadataExt的地方lsp-client/src/client/capabilities.rschunks_exact用了常量块长as_chunks::<5>().0git/src/diff_blocks.rs、git/src/configuration.rsas_chunks::<3>().0build/src/options.rsstored.keys()core/src/tests/build_systems.rsformat!root.to_string()as_chunks从 Rust 1.88 起稳定。原来的代码分块前已经检查长度能被整除,或者本来就丢弃不足一块的余数,as_chunks().0的行为和它一致。改动二:固定 Rust 1.100.0
rust-toolchain.toml(新增)channel = "1.100.0"。在仓库里运行cargo时,rustup 自动安装并使用这个版本.github/workflows/rust-core.ymldtolnay/rust-toolchain@stable改为@1.100.0.github/workflows/plugins-verify.yml@stable改为@1.100.0;SDK 最低版本测试仍是@1.87+cargo +1.87,注释同步scripts/rust-core/affected-crates.mjs及测试rust-toolchain.toml加入EVERY_CRATE,改动它会选中全部 crateCONTRIBUTING.mdrust-toolchain.tomlshared/plugins/README.md工作流和固定文件必须写同一个版本字符串:rustup 把
1.100和1.100.0当成两个工具链,写得不一致时 CI 会另装一份没有 clippy、rustfmt 和 Windows 目标的工具链。dtolnay/rust-toolchain内部一律用rustc +<版本>,所以@1.87那一步不受固定文件影响。对开发者的影响:已经用 rustup 的人第一次在仓库里运行
cargo时会自动下载 1.100.0,之后 Core 会完整重新编译一次;用 Homebrew 等非 rustup 方式安装的 Rust 不读这个文件。Lithe-IDEA 构建 Core 时用它自己仓库根目录的rust-toolchain.toml,那边另开 PR 同步固定到 1.100.0。验证(本地 macOS)
cargo clippy --workspace --all-targets --all-features -- -D warnings:通过。cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings:通过。cargo fmt --all --check:通过。affected-crates.mjs选出的 13 个 crate 测试全部通过:29 个测试套件,共 1347 个测试。verify-platform-tests.mjs52 个 crate 通过;CI 脚本测试 16 个全部通过。shared/plugins/sdk/rust里rustc -V都是 1.100.0(rustup show active-toolchain显示由rust-toolchain.toml覆盖);CI 脚本测试 16 个通过;affected-crates.mjs --base origin/main在 Linux 上选中--workspace;cargo fmt --all --check和verify-docs.mjs通过。验证(CI)
Rust Core gate通过;主机矩阵按 Draft 规则跳过Rust Core gate全部通过rust-toolchain.toml,按规则选中全部 crateSelect crates、Linux、Windows、macOS、Rust Core gate全部通过cargo +1.87步骤不受固定文件影响手动运行时,macOS 和 Windows 第一次在真实主机上跑平台测试:
-p lithe-platform -p lithe-platform-tests):lithe-platform15 个单元测试,lithe-platform-tests库 2 个,tests/platform10 个,全部通过。refactor(platform): 平台规则改为数据,平台专属测试移到 lithe-platform-tests #48 合入时没有在 Windows 上实测,这次补上了。-p lithe-platform -p lithe-remote -p lithe-platform-tests --features lithe-remote/server):tests/platform9 个,lithe-remote单元测试 56 个、集成测试 7 组,全部通过。