Skip to content

chore(deps): update rust crate toml to 0.9#3

Open
tomerqodo wants to merge 4 commits into
coderabbit_full_base_choredeps_update_rust_crate_toml_to_09_pr3from
coderabbit_full_head_choredeps_update_rust_crate_toml_to_09_pr3
Open

chore(deps): update rust crate toml to 0.9#3
tomerqodo wants to merge 4 commits into
coderabbit_full_base_choredeps_update_rust_crate_toml_to_09_pr3from
coderabbit_full_head_choredeps_update_rust_crate_toml_to_09_pr3

Conversation

@tomerqodo

@tomerqodo tomerqodo commented Jan 30, 2026

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#3

Summary by CodeRabbit

  • New Features

    • Added Flatpak as a supported bundle target option.
  • Chores

    • Updated toml dependency to version 0.9 across the build system.
    • Updated toml_edit dependency to version 0.23.
    • Expanded tauri-utils feature flags for enhanced configuration support.

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Multiple crate dependencies are upgraded, specifically toml from 0.8 to 0.9 across four Cargo.toml files, toml_edit from 0.22 to 0.23, and new tauri-utils features are enabled. Flatpak bundle target support is added to BundleType. TOML parse error handling is refactored.

Changes

Cohort / File(s) Summary
Dependency upgrades
crates/tauri-build/Cargo.toml, crates/tauri-cli/Cargo.toml, crates/tauri-plugin/Cargo.toml, crates/tauri-utils/Cargo.toml
Updated toml dependency from 0.8 to 0.9 across all crates. Additionally, updated toml_edit from 0.22 to 0.23 in tauri-cli and expanded tauri-utils features to include schema, config-json5, and config-toml.
Flatpak bundle support
crates/tauri-utils/src/config.rs
Added Flatpak variant to BundleType enum with corresponding implementations in all(), Display, and Deserialize to recognize and render flatpak bundles.
TOML error handling refactor
crates/tauri-utils/src/config/parse.rs
Changed TOML parse error mapping from ConfigError::FormatToml to ConfigError::FormatJson by wrapping errors as serde_json::Error; includes comment noting toml 0.9 yields different error types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through versions anew,
Toml climbs from 0.8 to 0.9—whoo!
Flatpak bundles hop into the fold,
Error handling refined, bold and gold!
Dependencies dance in perfect stride,
Build systems blessed with upgraded tide! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'chore(deps): update rust crate toml to 0.9' accurately describes the primary change across all modified Cargo.toml files, where the toml dependency is bumped from 0.8 to 0.9.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch coderabbit_full_head_choredeps_update_rust_crate_toml_to_09_pr3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

1 similar comment
@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@crates/tauri-utils/Cargo.toml`:
- Line 37: The toml 0.9 dependency only enables "parse" but the crate uses
serde-gated APIs (toml::Value, toml::de::Error, toml::from_str()), so update the
toml dependency entry to enable the "serde" feature as well (e.g., features =
["parse", "serde"]) so those APIs are available and the crate compiles; locate
the toml line in Cargo.toml and add "serde" to the features array.

In `@crates/tauri-utils/src/config.rs`:
- Line 180: BundleType::Flatpak is rendered as "Flatpak" in the Display impl
while other BundleType variants are lowercase, causing inconsistent serialized
output because Serialize uses Display; update the Display implementation for
BundleType (the match arm for Flatpak) to return the lowercase "flatpak" to
match the casing of the other variants and ensure consistent serialization.

In `@crates/tauri-utils/src/config/parse.rs`:
- Around line 384-391: The TOML parser in do_parse_toml currently maps
toml::from_str errors to ConfigError::FormatJson; change it to map parse
failures to ConfigError::FormatToml instead, preserving the path and converting
the toml error to a message (e.g., error.to_string()) for the
ConfigError::FormatToml error payload so users see a TOML-specific parse error;
update the map_err closure in do_parse_toml to construct ConfigError::FormatToml
with path.into() and the converted error text.

ctor = "0.2"
json5 = { version = "0.4", optional = true }
toml = { version = "0.8", features = ["parse"] }
toml = { version = "0.9", features = ["parse"] }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for toml usage patterns in tauri-utils
rg -n "toml::" crates/tauri-utils/src/ -A 2 -B 2

Repository: agentic-review-benchmarks/tauri-combined-coderabbit

Length of output: 4320


🏁 Script executed:

#!/bin/bash
# Also check for any toml module imports
rg -n "use toml" crates/tauri-utils/src/ -A 2 -B 2

Repository: agentic-review-benchmarks/tauri-combined-coderabbit

Length of output: 402


🏁 Script executed:

#!/bin/bash
# Check the actual Cargo.toml to see context around the dependency
cat -n crates/tauri-utils/Cargo.toml | sed -n '30,45p'

Repository: agentic-review-benchmarks/tauri-combined-coderabbit

Length of output: 764


🌐 Web query:

toml crate 0.9 breaking changes from 0.8 API compatibility

💡 Result:

Key breaking / API-compat changes when moving toml 0.8 → 0.9:

  • Serde is no longer unconditional: in 0.8, serde is a required dependency and toml::Value / toml::Table are always available (behind parse/display for parsing/printing). In 0.9, serde becomes an optional feature, and Value, Table, ser module, and from_str/to_string re-exports are gated behind feature = "serde". If you compile with default-features = false, code using toml::Value/toml::Table will break unless you enable serde. [1][2][3][4]

  • Feature set / defaults changed:

    • 0.8 defaults: default = ["parse", "display"]. [1]
    • 0.9 defaults: default = ["std", "serde", "parse", "display"] and adds new feature structure (std, serde, plus debug / fast_hash). [2]
  • Parser / writer backend changed:

    • 0.8 parse/display are implemented via an optional dependency on toml_edit. [1]
    • 0.9 parse uses toml_parser (+ winnow) and display uses toml_writer (and no longer depends on toml_edit). [2]
  • preserve_order now implies std in 0.9 (preserve_order = ["dep:indexmap", "std"]), while in 0.8 it was just ["indexmap"] (no explicit std requirement). [1][2]

  • unbounded feature semantics changed: in 0.8 it forwards to toml_edit?/unbounded; in 0.9 it’s defined as an empty feature (unbounded = []) (i.e., it no longer enables a backend capability the way it used to). [1][2]

How to keep behavior closest to 0.8:

  • If you previously relied on toml working with default-features = false, you likely now want something like:
    • features = ["serde", "parse", "display"] (and std if you need it / preserve_order).
  • Otherwise, using default features on 0.9 is the simplest path since it includes std + serde + parse + display by default. [2]

Sources: 0.8.23 Cargo features/deps [1], 0.9.0 Cargo features/deps [2], and lib.rs public re-exports showing new serde gating in 0.9 vs 0.8 [3][4].

References:
[1] https://docs.rs/crate/toml/0.8.23/source/Cargo.toml.orig
[2] https://docs.rs/crate/toml/0.9.0/source/Cargo.toml.orig
[3] https://docs.rs/crate/toml/0.8.23/source/src/lib.rs
[4] https://docs.rs/crate/toml/0.9.0/source/src/lib.rs


Add serde feature to toml 0.9 dependency.

The upgrade to toml 0.9 made serde an optional feature (it was unconditional in 0.8). The current configuration uses only features = ["parse"], but the code relies on serde-gated APIs like toml::Value, toml::de::Error, and toml::from_str(). This will cause compilation failures. Update to features = ["parse", "serde"].

🤖 Prompt for AI Agents
In `@crates/tauri-utils/Cargo.toml` at line 37, The toml 0.9 dependency only
enables "parse" but the crate uses serde-gated APIs (toml::Value,
toml::de::Error, toml::from_str()), so update the toml dependency entry to
enable the "serde" feature as well (e.g., features = ["parse", "serde"]) so
those APIs are available and the crate compiles; locate the toml line in
Cargo.toml and add "serde" to the features array.

Self::Nsis => "nsis",
Self::App => "app",
Self::Dmg => "dmg",
Self::Flatpak => "Flatpak",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent casing in Display impl for Flatpak.

BundleType::Flatpak displays as "Flatpak" (capitalized), while all other variants use lowercase ("deb", "rpm", "appimage", etc.). Since Serialize uses Display (line 191), this creates inconsistent serialization output.

✏️ Suggested fix for consistency
         Self::App => "app",
         Self::Dmg => "dmg",
-        Self::Flatpak => "Flatpak",
+        Self::Flatpak => "flatpak",
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Self::Flatpak => "Flatpak",
Self::App => "app",
Self::Dmg => "dmg",
Self::Flatpak => "flatpak",
}
🤖 Prompt for AI Agents
In `@crates/tauri-utils/src/config.rs` at line 180, BundleType::Flatpak is
rendered as "Flatpak" in the Display impl while other BundleType variants are
lowercase, causing inconsistent serialized output because Serialize uses
Display; update the Display implementation for BundleType (the match arm for
Flatpak) to return the lowercase "flatpak" to match the casing of the other
variants and ensure consistent serialization.

Comment on lines 384 to 391
#[cfg(feature = "config-toml")]
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
// Parse using toml 0.9's from_str which returns different error types
::toml::from_str(raw).map_err(|error| ConfigError::FormatJson {
path: path.into(),
error: Box::new(error),
error: serde_json::Error::custom(error.to_string()),
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: TOML parse errors incorrectly reported as JSON errors.

The TOML parse error is being mapped to ConfigError::FormatJson instead of ConfigError::FormatToml. This will produce misleading error messages to users—when a Tauri.toml file fails to parse, they'll see "unable to parse JSON Tauri config file" (from line 83).

The ConfigError::FormatToml variant exists at lines 103-112 and should be used here.

🐛 Proposed fix
 #[cfg(feature = "config-toml")]
 fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
   // Parse using toml 0.9's from_str which returns different error types
-  ::toml::from_str(raw).map_err(|error| ConfigError::FormatJson {
+  ::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
     path: path.into(),
-    error: serde_json::Error::custom(error.to_string()),
+    error: Box::new(error),
   })
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[cfg(feature = "config-toml")]
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
// Parse using toml 0.9's from_str which returns different error types
::toml::from_str(raw).map_err(|error| ConfigError::FormatJson {
path: path.into(),
error: Box::new(error),
error: serde_json::Error::custom(error.to_string()),
})
}
#[cfg(feature = "config-toml")]
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
// Parse using toml 0.9's from_str which returns different error types
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
path: path.into(),
error: Box::new(error),
})
}
🤖 Prompt for AI Agents
In `@crates/tauri-utils/src/config/parse.rs` around lines 384 - 391, The TOML
parser in do_parse_toml currently maps toml::from_str errors to
ConfigError::FormatJson; change it to map parse failures to
ConfigError::FormatToml instead, preserving the path and converting the toml
error to a message (e.g., error.to_string()) for the ConfigError::FormatToml
error payload so users see a TOML-specific parse error; update the map_err
closure in do_parse_toml to construct ConfigError::FormatToml with path.into()
and the converted error text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants