Skip to content

Remove dependency on once_cell#3653

Open
cyqsimon wants to merge 2 commits intosharkdp:masterfrom
cyqsimon:rm-once_cell
Open

Remove dependency on once_cell#3653
cyqsimon wants to merge 2 commits intosharkdp:masterfrom
cyqsimon:rm-once_cell

Conversation

@cyqsimon
Copy link
Copy Markdown
Contributor

@cyqsimon cyqsimon commented Mar 25, 2026

Queued behind #3652. Will rebase once (or if) that one is merged.

std now has all almost all the features from once_cell we need, and they have been stable well before our current MSRV. I think it's now okay to remove this dependency.

Comment on lines -93 to +99
self.syntax_set_cell
.get_or_try_init(|| self.serialized_syntax_set.deserialize())
// IMPRV: OnceCell::get_mut_or_init is preferable once stabalized
match self.syntax_set_cell.get() {
Some(set) => Ok(set),
None => {
let syntax_set = self.serialized_syntax_set.deserialize()?;
Ok(self.syntax_set_cell.get_or_init(|| syntax_set))
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This works but obviously is less than ideal.

I'll leave this decision up to maintains, whether the benefit of removing an external dependency outweighs the drawback of having this workaround.

@cyqsimon cyqsimon force-pushed the rm-once_cell branch 2 times, most recently from 2ddadc4 to f8a4ddf Compare March 26, 2026 04:44
- Standard library now has all the features we need
@cyqsimon cyqsimon marked this pull request as ready for review March 26, 2026 07:56
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.

1 participant