Skip to content

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

Open
tomerqodo wants to merge 4 commits intocoderabbit_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#29
tomerqodo wants to merge 4 commits intocoderabbit_full_base_choredeps_update_rust_crate_toml_to_09_pr3from
coderabbit_full_head_choredeps_update_rust_crate_toml_to_09_pr3

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 29, 2026

Benchmark PR from agentic-review-benchmarks#3

Summary by CodeRabbit

  • New Features

    • Added Flatpak as a new bundle target option for application distribution, enabling deployment through Flatpak repositories.
  • Dependencies

    • Updated toml parsing library from version 0.8 to 0.9 across all build packages.
    • Updated toml_edit library from version 0.22 to 0.23.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

This pull request updates the toml crate dependency across multiple packages (from version 0.8 to 0.9), bumps toml_edit from 0.22 to 0.23, introduces Flatpak as a new bundle target variant, and modifies TOML parsing error handling to use JSON error formatting instead.

Changes

Cohort / File(s) Summary
Dependency Updates
crates/tauri-build/Cargo.toml, crates/tauri-cli/Cargo.toml, crates/tauri-plugin/Cargo.toml, crates/tauri-utils/Cargo.toml
Bumped toml dependency from version 0.8 to 0.9 across all packages. Additionally, toml_edit updated from 0.22 to 0.23 in tauri-cli.
Flatpak Bundle Target
crates/tauri-utils/src/config.rs
Added Flatpak as a new variant to the BundleType enum. Extended the all() helper method to include the variant, updated Display implementation to output "Flatpak", and implemented deserialization support for case-insensitive "flatpak" string.
Error Handling Refactor
crates/tauri-utils/src/config/parse.rs
Changed TOML parsing error mapping in do_parse_toml from ConfigError::FormatToml to ConfigError::FormatJson, converting the error source to a string via serde_json::Error::custom instead of directly using toml::de::Error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 From 0.8 to 0.9, our toml takes flight,
Flatpak joins the bundle family, shining bright,
JSON errors now tell our parsing tales,
These modest bumps keep Tauri's code on rails! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: updating the toml dependency from 0.8 to 0.9 across multiple Cargo.toml files.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@crates/tauri-utils/src/config.rs`:
- Line 180: The Display implementation for BundleType returns "Flatpak" with
PascalCase which is inconsistent with other variants that use lowercase; update
the Display impl (impl Display for BundleType) so the Flatpak arm
(BundleType::Flatpak) returns "flatpak" (lowercase) to match the casing used by
the other variants and maintain consistent serialization of bundle types.

In `@crates/tauri-utils/src/config/parse.rs`:
- Around line 385-391: The do_parse_toml function currently maps TOML parsing
failures from ::toml::from_str to ConfigError::FormatJson, causing JSON-specific
error messages; change the map_err to produce ConfigError::FormatToml { path:
path.into(), error: Box::new(error) } (using the ::toml::de::Error boxed) so
TOML parse errors use the correct ConfigError::FormatToml variant—update the
closure in do_parse_toml to return that variant instead of creating a
serde_json::Error.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4593412 and 5e98b88.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • crates/tauri-build/Cargo.toml
  • crates/tauri-cli/Cargo.toml
  • crates/tauri-plugin/Cargo.toml
  • crates/tauri-utils/Cargo.toml
  • crates/tauri-utils/src/config.rs
  • crates/tauri-utils/src/config/parse.rs
🧰 Additional context used
🧬 Code graph analysis (1)
crates/tauri-utils/src/config/parse.rs (2)
crates/tauri-utils/src/config.rs (2)
  • from_str (1404-1423)
  • from_str (2823-2825)
crates/tauri-utils/src/acl/capability.rs (3)
  • from_str (318-322)
  • serde_json (300-300)
  • serde_json (306-306)
🔇 Additional comments (5)
crates/tauri-build/Cargo.toml (1)

46-46: LGTM - consistent with workspace-wide toml upgrade.

crates/tauri-plugin/Cargo.toml (1)

38-38: LGTM - optional dependency version updated correctly.

crates/tauri-utils/Cargo.toml (1)

37-37: LGTM - version updated with features preserved.

crates/tauri-utils/src/config.rs (1)

147-148: LGTM - Flatpak bundle type properly integrated.

The new Flatpak variant is correctly added to the enum, included in all(), and handled in deserialization.

Also applies to: 162-162, 209-209

crates/tauri-cli/Cargo.toml (1)

59-68: LGTM - dependency version bumps are correct and compatible.

The toml_edit 0.23 and toml 0.9 versions are companion releases from the toml-rs ecosystem, designed to work together. They share lower-level dependencies and Cargo will resolve them without conflicts.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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

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 implementation for Flatpak.

All other BundleType variants serialize to lowercase ("deb", "rpm", "appimage", etc.), but Flatpak serializes to PascalCase "Flatpak". This inconsistency may cause issues with config file conventions and tooling that expects lowercase bundle types.

Proposed fix for consistent lowercase casing
         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::Dmg => "dmg",
Self::Flatpak => "flatpak",
🤖 Prompt for AI Agents
In `@crates/tauri-utils/src/config.rs` at line 180, The Display implementation for
BundleType returns "Flatpak" with PascalCase which is inconsistent with other
variants that use lowercase; update the Display impl (impl Display for
BundleType) so the Flatpak arm (BundleType::Flatpak) returns "flatpak"
(lowercase) to match the casing used by the other variants and maintain
consistent serialization of bundle types.

Comment on lines 385 to 391
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

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:

# First, let's examine the do_parse_toml function and surrounding ConfigError definitions
fd parse.rs -t f --path "*tauri-utils*" | head -5

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 317


🏁 Script executed:

# Check the actual file structure and line count
wc -l crates/tauri-utils/src/config/parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 126


🏁 Script executed:

# Read the ConfigError enum definition and the specific function
sed -n '80,115p' crates/tauri-utils/src/config/parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 1106


🏁 Script executed:

# Read the do_parse_toml function at lines 385-391
sed -n '380,395p' crates/tauri-utils/src/config/parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 676


🏁 Script executed:

# Check the Cargo.toml to see which version of toml is used
grep -A 2 -B 2 'toml' crates/tauri-utils/Cargo.toml | head -20

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 418


🌐 Web query:

toml 0.9 rust crate de::Error type documentation

💡 Result:

In toml crate 0.9.x, the deserialization error type is:

  • toml::de::Error (a struct Error { /* private fields */ }) — “Errors that can occur when deserializing a type.” It provides:
    • message(&self) -> &str (what went wrong)
    • span(&self) -> Option<Range<usize>> (byte range in the original input)
    • set_input(&mut self, input: Option<&str>) (attach the original TOML for better diagnostics)
      It also implements serde::de::Error when the crate feature serde is enabled, and std::error::Error when std is enabled. [1]

Docs: toml::de::Error on docs.rs (toml 0.9.11+spec-1.1.0). [1]

Sources:
[1] https://docs.rs/toml/latest/toml/de/struct.Error.html


Critical: TOML parsing errors incorrectly mapped to JSON error type.

The do_parse_toml function maps TOML parsing errors to ConfigError::FormatJson, which produces misleading error messages like "unable to parse JSON Tauri config file" when parsing a TOML file fails. The code should use the existing ConfigError::FormatToml variant instead, which correctly expects Box<::toml::de::Error> and produces the appropriate error message.

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
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()),
})
}
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::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 385 - 391, The
do_parse_toml function currently maps TOML parsing failures from
::toml::from_str to ConfigError::FormatJson, causing JSON-specific error
messages; change the map_err to produce ConfigError::FormatToml { path:
path.into(), error: Box::new(error) } (using the ::toml::de::Error boxed) so
TOML parse errors use the correct ConfigError::FormatToml variant—update the
closure in do_parse_toml to return that variant instead of creating a
serde_json::Error.

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