-
Notifications
You must be signed in to change notification settings - Fork 108
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
ff #49
Merged
Merged
ff #49
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fix for more idiomatic code. also, this variable likely would not need to be investigated further than this.
if you think about it we don't even need to keep the response in memory since we are only looking for the size
simpler string formatting
changing the unwrap was more involved but i think it became better https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_unwrap
The long unwrap chain can also be fixed but it's also a matter of error management so i'm keeping it as is https://rust-lang.github.io/rust-clippy/master/index.html#/single_match
Not all borrows are needless in this context but if the traits are implemented in a way (either by default or by the code) that automatically copies, when the reference is immediately used and never used again, & might be unnecessary https://rust-lang.github.io/rust-clippy/master/index.html#/needless_borrow
expect CAN be idiomatic but this does not seem to be the case here. https://rust-lang.github.io/rust-clippy/master/index.html#/expect_fun_call
fix for more idiomatic code. also, this variable likely would not need to be investigated further than this.
if you think about it we don't even need to keep the response in memory since we are only looking for the size
simpler string formatting
changing the unwrap was more involved but i think it became better https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_unwrap
remove redundant variables for clarity. change match to if sense we are only interested in one case.
we're skipping the okay case so we only need to check the Err(e) case
note that `bits` can (and should) be immutable now. this is because after initialization, no `AtomicU32`s are added nor removed from `bits` We are instead relying on interior mutability of the `Vec` through the internal type `AtomicU32` https://doc.rust-lang.org/reference/interior-mutability.html
you can remove the panic here if you still want to run to propagate error somehow from here
we want to retrieve the unwrapped line here. If it is Ok(line) it is unwrapped. if it is Err(e) we log the line_number, doc location and error e. end then we break, specifically the line processing loop
consolidate it into one function
? is idiomatic to replace match that is used only to propagate errors
to_string is infallible(cannot fail and checked during conpile) for string literal
we still have the unwrap, which could be removed as well but this is as concise while leaving the unwrap there
fix rust parts
Add rust unit tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.