Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project: apply cargo fmt universally, verify in CI. #146

Merged
merged 5 commits into from
Sep 7, 2023

Conversation

cpu
Copy link
Member

@cpu cpu commented Aug 25, 2023

Self-explanatory. Applies cargo fmt universally, adds a CI job to ensure consistent formatting going forward. No functional changes.

@cpu cpu self-assigned this Aug 25, 2023
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

To be explicit, here's why I think this is a good idea:

  1. The default cargo fmt settings represent idiomatic style, that is used across most Rust projects
  2. Automatic formatting tooling makes life easier for contributors
  3. Style enforcement in CI avoids (some) additional review roundtrips due to stylistic concerns

@cpu
Copy link
Member Author

cpu commented Aug 25, 2023

To be explicit, here's why I think this is a good idea

Thanks for adding motivating context. I should have done that in my PR description 👍 Your points echo the feelings I expressed in this comment.

@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Merging #146 (772795e) into main (390e3ad) will decrease coverage by 1.32%.
The diff coverage is 66.36%.

@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
- Coverage   71.60%   70.28%   -1.32%     
==========================================
  Files           7        7              
  Lines        1729     1898     +169     
==========================================
+ Hits         1238     1334      +96     
- Misses        491      564      +73     
Files Changed Coverage Δ
src/error.rs 1.92% <0.00%> (-0.86%) ⬇️
src/main.rs 0.00% <0.00%> (ø)
src/sign_algo.rs 49.03% <61.53%> (-0.48%) ⬇️
src/csr.rs 72.54% <62.50%> (+0.80%) ⬆️
src/lib.rs 72.99% <71.08%> (-0.72%) ⬇️
src/key_pair.rs 69.23% <75.51%> (-0.25%) ⬇️
src/crl.rs 93.13% <84.00%> (-1.95%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@est31
Copy link
Member

est31 commented Aug 29, 2023

Btw, would it be possible to remove these coverage comments? they are put on every PR, even ones that don't touch anything related to tests. I think it's cool to have coverage reports you can browse online and look at graphs, but I don't think one needs to have a comment for each PR on how it changes the doc coverage.

As for autoformatters, I think there are some options that make cargo fmt nicer, I will make some experiments and will then propose something.

@cpu
Copy link
Member Author

cpu commented Aug 29, 2023

Btw, would it be possible to remove these coverage comments?

I'll look into that.

As for autoformatters, I think there are some options that make cargo fmt nicer, I will make some experiments and will then propose something.

@est31 Does this PR need to wait for that adjustment? The benefit of machine formatting is that if you change the rules of the formatter, you can run it again.

@cpu
Copy link
Member Author

cpu commented Aug 29, 2023

Btw, would it be possible to remove these coverage comments?

I'll look into that.

Let's try this first: #149

@cpu cpu assigned est31 and unassigned cpu Aug 31, 2023
This commit checks in the result of running `cargo fmt` across the
project tree.
This commit adds a job to the `ci.yml` workflow that ensures `cargo fmt`
has been applied consistently.
@djc
Copy link
Member

djc commented Sep 6, 2023

As for autoformatters, I think there are some options that make cargo fmt nicer, I will make some experiments and will then propose something.

@est31 Does this PR need to wait for that adjustment? The benefit of machine formatting is that if you change the rules of the formatter, you can run it again.

@est31 friendly ping on this? Would be nice for further changes to get the formatting done first.

@est31
Copy link
Member

est31 commented Sep 7, 2023

It's a pity that overflow_delimited_expr isn't stable. Idk about you but I like former way more:

-		assert_eq!(uris, &[
-			"http://example.com/crl.der",
-			"http://crls.example.com/1234",
-			"ldap://example.com/crl.der"
-		]);
+		assert_eq!(
+			uris,
+			&[
+				"http://example.com/crl.der",
+				"http://crls.example.com/1234",
+				"ldap://example.com/crl.der"
+			]
+		);

@iamjpotts
Copy link
Contributor

It's a pity that overflow_delimited_expr isn't stable. Idk about you but I like former way more:

-		assert_eq!(uris, &[
-			"http://example.com/crl.der",
-			"http://crls.example.com/1234",
-			"ldap://example.com/crl.der"
-		]);
+		assert_eq!(
+			uris,
+			&[
+				"http://example.com/crl.der",
+				"http://crls.example.com/1234",
+				"ldap://example.com/crl.der"
+			]
+		);

I like the latter way, but I'm also glad that rustfmt isn't black

@est31 est31 merged commit 163b8d4 into rustls:main Sep 7, 2023
9 of 11 checks passed
@cpu cpu deleted the cpu-fmt-all-the-things branch September 7, 2023 12:42
@cpu
Copy link
Member Author

cpu commented Sep 7, 2023

Thanks 👍

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.

4 participants