From fee185358ee9eb69aece2d874b5df2b91c3f6b87 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 19 Nov 2024 09:31:15 +0100 Subject: [PATCH 1/5] styles: Adjust max tooltip width Without this the "Minimum Supported Rust Version" tooltip has a weird line break for no good reason. --- app/styles/application.module.css | 1 + 1 file changed, 1 insertion(+) diff --git a/app/styles/application.module.css b/app/styles/application.module.css index d2f39be49bc..3a8d4b583d5 100644 --- a/app/styles/application.module.css +++ b/app/styles/application.module.css @@ -202,5 +202,6 @@ noscript { } :global(.ember-tooltip) { + max-width: 300px; font-weight: normal; } From 1f9f0a31c011402bf4e87c098fe0c12073f9be8e Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 19 Nov 2024 09:31:51 +0100 Subject: [PATCH 2/5] models/version: Infer `msrv` attribute based on `edition` if `rust_version` is not set --- app/models/version.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/models/version.js b/app/models/version.js index 87b1c29a2ec..a49ab2b9369 100644 --- a/app/models/version.js +++ b/app/models/version.js @@ -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} */ @@ -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() { From dd77e02b2f0687671cdc6a9b8d3fb52a90dfb376 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 19 Nov 2024 09:32:33 +0100 Subject: [PATCH 3/5] components/version-list: Use `word-break` only for `.version` children --- app/components/version-list/row.module.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/version-list/row.module.css b/app/components/version-list/row.module.css index c088ffc29e2..6253274b54f 100644 --- a/app/components/version-list/row.module.css +++ b/app/components/version-list/row.module.css @@ -46,10 +46,6 @@ z-index: 1; cursor: help; } - - :global(.ember-tooltip) { - word-break: break-all; - } } .version { @@ -57,6 +53,10 @@ grid-template-columns: auto auto; place-items: center; + :global(.ember-tooltip) { + word-break: break-all; + } + @media only screen and (max-width: 550px) { grid-template-columns: auto; margin: 0 var(--space-s); From 918e0b512161f4244c451bc53cbdf7ad734f13c5 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 19 Nov 2024 09:35:39 +0100 Subject: [PATCH 4/5] components/version-list: Show Rust Edition requirement if set --- app/components/version-list/row.hbs | 7 +++++++ app/components/version-list/row.module.css | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/app/components/version-list/row.hbs b/app/components/version-list/row.hbs index 29d38afc667..137a72adc0d 100644 --- a/app/components/version-list/row.hbs +++ b/app/components/version-list/row.hbs @@ -71,6 +71,13 @@ {{svg-jar "rust"}} v{{@version.msrv}} + + + "Minimum Supported Rust Version" + {{#if @version.edition}} +
requires Rust Edition {{@version.edition}}
+ {{/if}} +
{{/if}} diff --git a/app/components/version-list/row.module.css b/app/components/version-list/row.module.css index 6253274b54f..63722b01f09 100644 --- a/app/components/version-list/row.module.css +++ b/app/components/version-list/row.module.css @@ -212,6 +212,10 @@ } } +.edition { + margin-top: var(--space-2xs); +} + .bytes { font-variant-numeric: tabular-nums; text-transform: none; From cf749de1530c3a5ec53ebbe2ff4dde39ae04d8c0 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 19 Nov 2024 09:35:48 +0100 Subject: [PATCH 5/5] components/crate-sidebar: Show Rust Edition requirement if set --- app/components/crate-sidebar.hbs | 8 +++++++- app/components/crate-sidebar.module.css | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/components/crate-sidebar.hbs b/app/components/crate-sidebar.hbs index 1ace1a533e7..d078b5f6790 100644 --- a/app/components/crate-sidebar.hbs +++ b/app/components/crate-sidebar.hbs @@ -22,7 +22,13 @@ {{svg-jar "rust"}} v{{@version.msrv}} - + + + "Minimum Supported Rust Version" + {{#if @version.edition}} +
requires Rust Edition {{@version.edition}}
+ {{/if}} +
{{/if}} diff --git a/app/components/crate-sidebar.module.css b/app/components/crate-sidebar.module.css index 0ca5c3ad98f..c66bdc2f1d6 100644 --- a/app/components/crate-sidebar.module.css +++ b/app/components/crate-sidebar.module.css @@ -40,6 +40,10 @@ } } +.edition { + margin-top: var(--space-2xs); +} + .license { a { color: var(--main-color);