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

ff #49

Merged
merged 68 commits into from
Sep 24, 2023
Merged

ff #49

merged 68 commits into from
Sep 24, 2023

Conversation

soldni
Copy link
Member

@soldni soldni commented Sep 24, 2023

No description provided.

chris-ha458 and others added 30 commits August 19, 2023 23:43
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
chris-ha458 and others added 29 commits August 23, 2023 13:29
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
we already have descriptive names
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
@soldni soldni merged commit 07a745c into soldni/warc Sep 24, 2023
20 checks passed
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.

2 participants