vim-doge icon indicating copy to clipboard operation
vim-doge copied to clipboard

Handle case when rust macro node has no children of type identifier

Open TabulateJarl8 opened this issue 11 months ago • 2 comments

Prelude

Thank you for helping out vim-doge!

By contributing to vim-doge you agree to the following statements:

Why this PR?

To do an unhandled unwrap expression in the rust parser, vim-doge would crash if a macro within a function had no children with the type of identifier (from my understanding of the code). A minimal reproducible example of this would be with the log crate:

fn testing() {
 log::info!("this will crash");
}

Note that this doesn't even have to be within a Rust project as it will crash either way. I fixed this bug by just saying that the item doesn't panic if it has no children which are identifiers, which I believe was the intended behavior.

If you'd like me to remove the other changes that rustfmt automatically did when I saved the file, I can do that, but it did make it more consistent as there we're a few spots with 2-space indentation while the rest of the file was 4-space.

Thanks so much!

TabulateJarl8 avatar Feb 05 '25 18:02 TabulateJarl8

@TabulateJarl8 please rebase from master again, because I had to update the workflow files to make the automated tests work again :)

kkoomen avatar Apr 06 '25 14:04 kkoomen

@kkoomen should be done now. Not sure if it wants you to re-approve or if the CI just takes a minute to spin up, but seems like it wants approval on my end

TabulateJarl8 avatar Apr 06 '25 17:04 TabulateJarl8