fix(BREAKING): upgrade to dprint-core 0.69.1 and remove anyhow - #64
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades
dprint-corefrom 0.67.0 to 0.69.0 (keeping theprocessfeature).Why source changes were needed
dprint-core 0.68.0 removed its
anyhowdependency, so the plugin handler APIs now usedprint_core::plugins::FormatErrorinstead ofanyhow::Error.FormatResultis nowResult<Option<Vec<u8>>, FormatError>, andhandle_process_stdio_messagesreturnsResult<(), FormatError>.Changes
Cargo.toml:dprint-core0.67.0 -> 0.69.0, dropped the directanyhowdependency.src/handler.rs: replacedanyhow::Error/anyhow::Result/anyhow!/bail!withFormatErrorandFormatError::new(...). The?plumbing overJoinError,oneshot::error::RecvErrorandstd::io::Errorstill works because dprint-core implementsFromfor those onFormatError.SetupInitError::Failednow holds aFormatError.src/main.rs:fn main() -> Result<(), FormatError>.Cargo.toml/tests/tests.rs:dprint-development0.10.1 -> 0.11.0. This was forced — 0.10.x'srun_specscallback signature isanyhow::Result<Option<String>>, which the plugin can no longer produce without keepinganyhowpurely for the test harness. 0.11.0 usesResult<Option<String>, Box<dyn std::error::Error + Send + Sync>>, so the spec test just adds.map_err(Into::into).No behavior changes: all error messages are byte-for-byte identical to before.
dprint_core::formatting::ir_helpers::GeneratedValuegained anis_known_multi_linefield in 0.69.0, but this plugin doesn't use the IR, so nothing to do there.Verification
cargo check --all-targetscleancargo test: 18 passed, 0 failed (16 unit, 1 spec test covering 9 sub-specs, 1 doc test)cargo clippy --all-targets: only the two pre-existing warnings (manual arithmetic check,needlessly owned Cow type)rustfmt --edition 2024anddprint fmt