yoda: cosmic-theme cleanup (4→0 warnings) — workspace at 0 warnings total
theme::Builder::build: - #[allow(unused_assignments)] with a note explaining the pattern: the component_hovered/pressed_overlay seeds at the top of the function are overwritten by every container block (primary, secondary, …) before being read, which is what unused_assignments flagged. vs_code.rs: - Add doc + # Errors section to Theme::apply_vs_code and the associated Theme::reset_vs_code (was missing under #![warn(missing_docs)]). Cargo.toml profile move: - cosmic-theme had a [profile.dev.package] block that Cargo silently ignores in non-root manifests. Move the insta/similar opt-level=3 hint to the workspace root and drop the dead block from the cosmic-theme manifest. Removes the cargo-level "profiles for the non root package will be ignored" notice that came up on every check. Leyoda 2026 – GPLv3
This commit is contained in:
parent
84437e219b
commit
999db0a4bd
4 changed files with 29 additions and 3 deletions
|
|
@ -264,5 +264,13 @@ exclude = ["iced", "examples"]
|
|||
[workspace.dependencies]
|
||||
dirs = "6.0.0"
|
||||
|
||||
# Speed up snapshot diffing in cosmic-theme tests. Cargo silently ignores
|
||||
# [profile.*] blocks in non-root manifests, so this lives at the
|
||||
# workspace root.
|
||||
[profile.dev.package.insta]
|
||||
opt-level = 3
|
||||
[profile.dev.package.similar]
|
||||
opt-level = 3
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.27.0"
|
||||
|
|
|
|||
|
|
@ -34,6 +34,3 @@ thiserror = "2.0.18"
|
|||
[dev-dependencies]
|
||||
insta = "1.47.2"
|
||||
|
||||
[profile.dev.package]
|
||||
insta.opt-level = 3
|
||||
similar.opt-level = 3
|
||||
|
|
|
|||
|
|
@ -953,6 +953,12 @@ impl ThemeBuilder {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
// The component_hovered/pressed_overlay vars are seeded once near the
|
||||
// top of this fn and then reassigned inside each container block
|
||||
// (primary, secondary, …) before being read again. The initial seed
|
||||
// is therefore overwritten before any read, which is what the
|
||||
// unused_assignments lint flags below.
|
||||
#[allow(unused_assignments)]
|
||||
/// build the theme
|
||||
pub fn build(self) -> Theme {
|
||||
let Self {
|
||||
|
|
|
|||
|
|
@ -266,6 +266,14 @@ impl From<Theme> for VsTheme {
|
|||
}
|
||||
|
||||
impl Theme {
|
||||
/// Write this theme to VS Code's `settings.json` as a
|
||||
/// `workbench.colorCustomizations` entry, and enable
|
||||
/// `window.autoDetectColorScheme` so VS Code follows the system theme.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an `OutputError` if the user config dir is missing, the
|
||||
/// settings file cannot be read/written, or its JSON is invalid.
|
||||
#[cold]
|
||||
pub fn apply_vs_code(self) -> Result<(), OutputError> {
|
||||
let vs_theme = VsTheme::from(self);
|
||||
|
|
@ -291,6 +299,13 @@ impl Theme {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove the `workbench.colorCustomizations` entry previously written
|
||||
/// by [`Theme::apply_vs_code`] from VS Code's `settings.json`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an `OutputError` if the user config dir is missing, the
|
||||
/// settings file cannot be read/written, or its JSON is invalid.
|
||||
#[cold]
|
||||
pub fn reset_vs_code() -> Result<(), OutputError> {
|
||||
let mut config_dir = dirs::config_dir().ok_or(OutputError::MissingConfigDir)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue