Skip to content

Introduce formatting infra for Rust and format Rust code - #1037

Open
LittleHuba wants to merge 3 commits into
mainfrom
ulhu_enable_rustfmt
Open

Introduce formatting infra for Rust and format Rust code#1037
LittleHuba wants to merge 3 commits into
mainfrom
ulhu_enable_rustfmt

Conversation

@LittleHuba

Copy link
Copy Markdown
Contributor

No description provided.

@LittleHuba

Copy link
Copy Markdown
Contributor Author

Requested feedback from @bharatGoswami8 whether rustfmt config is fine for him.

Edition 2021 seems to be the agreed upon edition in S-CORE for now.
@limdor

limdor commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Please rename PR title, it is misleading. It is doing more than just formatting

@LittleHuba LittleHuba changed the title Format Rust code Introduce formatting infra for Rust and format Rust code Sep 2, 2026
Comment thread score/mw/com/rust/BUILD
srcs = ["score_com.rs"],
crate_name = "score_com",
edition = "2024",
edition = "2021",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

will revert back this once score_rust_policies upgrade to 2024

Ticket created for same -
eclipse-score/score_rust_policies#13

@@ -17,7 +17,7 @@ rust_library(
name = "com-api-example-lib",
srcs = glob(["src/**/*.rs"]),
crate_name = "com_api_example",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Edition 2021 seems to be the agreed upon edition in S-CORE for now.

Please update the commit message to link where S-CORE says that Rust 2021 should be used.

srcs = glob(["src/**/*.rs"]),
crate_name = "com_api_example",
edition = "2024",
edition = "2021",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we specifying rust edition per target? This is like in C++ we would specify the C++ version per target. If edition is not specified, it defaults to the one used by the toolchain.
If there is no good reason to specify the edition in every single target, I would like we specify it only in the toolchain.

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.

Fair point. @bharatGoswami8 if you do not disagree, I'll do that change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agreed as we are going to use default so we can remove this completely - https://github.com/eclipse-score/toolchains_rust/blob/main/toolchains/x86_64-unknown-linux-gnu/BUILD.bazel#L24

@LittleHuba

Copy link
Copy Markdown
Contributor Author

This PR is blocked by eclipse-score/score_rust_policies#13
A downgrade to edition 2021 is impossible.
Upgrading to 2024 will lead to incompatibility with rustfmt.

@bharatGoswami8

bharatGoswami8 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This PR is blocked by eclipse-score/score_rust_policies#13 A downgrade to edition 2021 is impossible. Upgrading to 2024 will lead to incompatibility with rustfmt.

Created a ticket to upgrade the Rust Edition 2024: eclipse-score/toolchains_rust#42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants