fix: Fix format_args lowering for >=1.87

This commit is contained in:
Lukas Wirth 2025-04-06 09:32:54 +02:00
parent 55c8cdeafb
commit e7ce86ddea
7 changed files with 128 additions and 53 deletions

View file

@ -303,6 +303,19 @@ pub struct CrateWorkspaceData {
pub toolchain: Option<Version>,
}
impl CrateWorkspaceData {
pub fn is_atleast_187(&self) -> bool {
const VERSION_187: Version = Version {
major: 1,
minor: 87,
patch: 0,
pre: Prerelease::EMPTY,
build: BuildMetadata::EMPTY,
};
self.toolchain.as_ref().map_or(false, |v| *v >= VERSION_187)
}
}
fn toolchain_channel(db: &dyn RootQueryDb, krate: Crate) -> Option<ReleaseChannel> {
krate.workspace_data(db).toolchain.as_ref().and_then(|v| ReleaseChannel::from_str(&v.pre))
}