Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@TheLostLambda
Copy link
Contributor

@TheLostLambda TheLostLambda commented Apr 26, 2025

Closes #435 and should just be a patch-level SemVer change!

Currently blocking the removal of syn from kdl-rss dependency tree, but with this PR merged, that should become rather straightforward!

I also found and fixed a bug leading to compilation errors in ffe374c, some clippy lints, and reused some code in 53c8330.

I also added tests wherever I was replacing Error or Diagnostic derives with something hand-written, just to be sure I wasn't changing any behavior!

Before this change, the `fancy` feature required the `derive` feature to
compile. Despite this, `derive` was not listed as a required feature to
use `fancy`. This meant that building with:
`cargo build --no-default-features --features fancy` would result in a
compilation error!

Now `fancy` can be used without `derive` enabled, and another use of
`thiserror` has been removed!
@TheLostLambda
Copy link
Contributor Author

TheLostLambda commented Apr 26, 2025

Not sure what the doc consistency check is about, @zkat ! It seems to generate this diff, deleting a section of the README if I run the command in the makefile, but I don't know if that's correct...

image

EDIT: It looks like this check was already failing on main, so I won't touch the README yet...

Copy link
Owner

@zkat zkat left a comment

Choose a reason for hiding this comment

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

So exciting! Thanks so much for taking the time!

write!(f, "{msg}")
}
}
impl Error for DiagnosticError {}
Copy link
Owner

Choose a reason for hiding this comment

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

error(transparent) forwards the source method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ach! Good catch! I think my tests must have missed that by not using an error with a source... I'll fix that up now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now!

/// [`chain()`](Report::chain).
pub fn root_cause(&self) -> &(dyn StdError + 'static) {
self.chain().last().unwrap()
self.chain().next_back().unwrap()
Copy link
Owner

Choose a reason for hiding this comment

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

For why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was one of the clippy lints! Because that iterator is double-ended, you can just pop from the back to get the last element more efficiently!

Apparently calling .last() is wasteful in this case because it iterates through the whole iterator before it can return the last value (https://rust-lang.github.io/rust-clippy/stable/index.html#/next_back)

I hadn't thought about that before!

Copy link
Owner

Choose a reason for hiding this comment

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

Oh! Huh! Good call

@TheLostLambda
Copy link
Contributor Author

I suppose changing MSRV is probably not a SemVer patch change... I'll roll back my fancy-pants io::Error::other(...) from 1.74 😅 ...

@TheLostLambda
Copy link
Contributor Author

TheLostLambda commented Apr 26, 2025

Trying to fix that README thing now too, since the CI bullied me and I'm looking for revenge (green checkmark...)

@TheLostLambda
Copy link
Contributor Author

CI successfully slain ⚔️ 😌

Should be ready for review again!

@zkat
Copy link
Owner

zkat commented Apr 26, 2025

Thanks a bunch for this! I'll roll a new release later today. Feel free to ping me if I forget :)

@TheLostLambda
Copy link
Contributor Author

Sounds like a great plan! That'll be great for unblocking the kdl-rs changes ☺️

@zkat zkat merged commit 521ef91 into zkat:main Apr 26, 2025
15 checks passed
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.

Remove thiserror dependency?

2 participants