Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions app/models/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export default class Version extends Model {
*/
@attr rust_version;

/**
* The Rust edition required to compile this crate version.
* @type {string | null}
*/
@attr edition;

/** @type {boolean | null} */
@attr has_lib;
/** @type {string[] | null} */
Expand All @@ -46,8 +52,14 @@ export default class Version extends Model {

get msrv() {
let rustVersion = this.rust_version;
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
if (rustVersion) {
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
} else if (this.edition === '2018') {
return '1.31.0';
} else if (this.edition === '2021') {
return '1.56.0';
}
}

get isNew() {
Expand Down
Loading