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

Cargo fmt + minor stuff #41

Merged
merged 4 commits into from
Jun 15, 2021
Merged

Cargo fmt + minor stuff #41

merged 4 commits into from
Jun 15, 2021

Conversation

maciejhirsz
Copy link
Contributor

@maciejhirsz maciejhirsz commented Jun 15, 2021

  • cargo fmt (fixes Is rustfmt welcome here? #28).
  • Used the concat! macro in response headers to make them a notch faster.
  • Added body to Response::Reject so the user can send intelligible errors back.

@maciejhirsz maciejhirsz requested review from dvdplm and jsdw June 15, 2021 07:58
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

LGTM.

I would prefer it if the changes to the rejection error to include the body were in a separate PR but I'm ok merging it here too if @jsdw and @niklasad1 are on-board as well.

@maciejhirsz
Copy link
Contributor Author

Rolled back the body, it works, but it doesn't even show up in firefox dev tools, so it's kind of useless :)

@dvdplm
Copy link
Contributor

dvdplm commented Jun 15, 2021

One thing though: we have a semi-standard rustfmt.toml file (e.g. here). I think we should use it here too.

So it'd be:

hard_tabs = true
max_width = 120
use_small_heuristics = "Max"
edition = "2018"

@dvdplm dvdplm requested a review from niklasad1 June 15, 2021 08:30
src/base.rs Outdated
Comment on lines 574 to 584
Error::Io(e) => write!(f, "i/o error: {}", e),
Error::UnknownOpCode => f.write_str("unknown opcode"),
Error::ReservedOpCode => f.write_str("reserved opcode"),
Error::FragmentedControl => f.write_str("fragmented control frame"),
Error::InvalidControlFrameLen => f.write_str("invalid control frame length"),
Error::InvalidReservedBit(n) => write!(f, "invalid reserved bit: {}", n),
Error::PayloadTooLarge { actual, maximum } => write!(
f,
"payload too large: len = {}, maximum = {}",
actual, maximum
),
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a shame; I liked how this had been laid out :)

@maciejhirsz
Copy link
Contributor Author

One thing though: we have a semi-standard rustfmt.toml file (e.g. here). I think we should use it here too.

Applied!

@jsdw jsdw merged commit bc231ee into develop Jun 15, 2021
@maciejhirsz maciejhirsz deleted the mh-boyscouting branch June 16, 2021 11:07
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.

Is rustfmt welcome here?
4 participants