-
Notifications
You must be signed in to change notification settings - Fork 431
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
remove single whitespace prefix from comments and docs #1385
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1385 +/- ##
==========================================
+ Coverage 71.65% 72.01% +0.36%
==========================================
Files 177 176 -1
Lines 5937 5911 -26
==========================================
+ Hits 4254 4257 +3
+ Misses 1683 1654 -29
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
crates/metadata/src/utils.rs
Outdated
@@ -56,3 +57,11 @@ where | |||
|
|||
deserializer.deserialize_str(Visitor) | |||
} | |||
|
|||
pub fn trim_extra_whitespace(item: &'static str) -> &'static str { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn trim_extra_whitespace(item: &'static str) -> &'static str { | |
pub fn trim_extra_whitespace(item: &str) -> &str { |
Lifetimes can be elided
this.spec.docs = docs.into_iter().collect::<Vec<_>>(); | ||
this.spec.docs = docs | ||
.into_iter() | ||
.map(trim_extra_whitespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot, could you update the trim_docs
test: https://github.com/paritytech/ink/blob/47b1fa3291dd7551002e780ace31df4d80e8539d/crates/metadata/src/tests.rs#L180 (or add a new one) to cover this, and also to test the updated trimming logic?
@@ -56,3 +57,11 @@ where | |||
|
|||
deserializer.deserialize_str(Visitor) | |||
} | |||
|
|||
pub fn trim_extra_whitespace(item: &str) -> &str { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a short comment to this public function
* remove single whitespace prefix from comments and docs * format code to please CI * elided lifetime + tests * adds comments to tests * add docs for public function
Closes #613
Only a single white space is removed which comes under the assumption that the user uses the standard cargo formatting style.
Example of trimming