chore(deps): update rust crate toml to 0.9#29
Conversation
WalkthroughThis pull request updates the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
crates/tauri-build/Cargo.tomlcrates/tauri-cli/Cargo.tomlcrates/tauri-plugin/Cargo.tomlcrates/tauri-utils/Cargo.tomlcrates/tauri-utils/src/config.rscrates/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
Flatpakvariant is correctly added to the enum, included inall(), 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_edit0.23 andtoml0.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", |
There was a problem hiding this comment.
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.
| 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.
| 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()), | ||
| }) | ||
| } |
There was a problem hiding this comment.
🧩 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 -5Repository: 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.rsRepository: 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.rsRepository: 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.rsRepository: 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 -20Repository: 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(astruct 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 implementsserde::de::Errorwhen the crate featureserdeis enabled, andstd::error::Errorwhenstdis 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.
| 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.
Benchmark PR from agentic-review-benchmarks#3
Summary by CodeRabbit
New Features
Dependencies
✏️ Tip: You can customize this high-level summary in your review settings.