chore: clear clippy warnings and tighten the build guard

- base64_encode uses div_ceil plus a slice loop (clippy: manual_div_ceil,
  chunks_exact_to_as_chunks); add known-vector tests.
- macOS-only UserEvent variants no longer warn on Windows.
- needless borrow, needless bool, and a collapsible match arm in the
  Destroyed handler.
- build.ps1 no longer treats the word "powershell" as an updater marker;
  it now checks Start-Process / Invoke-WebRequest instead.
This commit is contained in:
2026-11-03 22:11:03 +08:00
parent c783a6dc56
commit 8221eb5908
2 changed files with 31 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
#requires -Version 5.1
#requires -Version 5.1
<#
MD Preview 开发构建(DSH workspace-write / Low 完整性可运行)
- cargo test + cargo build --release
@@ -72,7 +72,9 @@ $hash = (Get-FileHash $built -Algorithm SHA256).Hash
Step 'check removed update strings'
$bytes = [IO.File]::ReadAllBytes($built)
$ascii = [Text.Encoding]::ASCII.GetString($bytes)
$forbidden = @('api.github', 'btn-update', 'Check for Updates', 'powershell', 'update-check-result', 'open-url')
# Guard the removed updater. 'powershell' used to be on this list, but that word
# can legitimately show up in user-facing text; the updater itself needs these.
$forbidden = @('api.github', 'btn-update', 'Check for Updates', 'Start-Process', 'Invoke-WebRequest', 'update-check-result', 'open-url')
$bad = @()
foreach ($needle in $forbidden) {
$count = ([regex]::Matches($ascii, [regex]::Escape($needle), 'IgnoreCase')).Count