Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Use derive debug for custom enum and struct definitions #111

Merged
merged 1 commit into from
Aug 8, 2017
Merged

Use derive debug for custom enum and struct definitions #111

merged 1 commit into from
Aug 8, 2017

Conversation

whimboo
Copy link
Collaborator

@whimboo whimboo commented Aug 7, 2017

This PR will fix issue #110.


This change is Reviewable

@whimboo
Copy link
Collaborator Author

whimboo commented Aug 7, 2017

It looks like that I need some more derives.

@whimboo
Copy link
Collaborator Author

whimboo commented Aug 8, 2017

So I have a problem to make one single enum derivable from debug:
https://github.com/mozilla/webdriver-rust/blob/master/src/server.rs#L21

Whenever I add the derive line here I get the following error which I'm not able to solve:

error[E0277]: the trait bound `<U as httpapi::WebDriverExtensionRoute>::Command: std::fmt::Debug` is not satisfied
  --> src/server.rs:23:21
   |
23 |     HandleWebDriver(WebDriverMessage<U>, Sender<WebDriverResult<WebDriverResponse>>),
   |                     ^^^^^^^^^^^^^^^^^^^^ `<U as httpapi::WebDriverExtensionRoute>::Command` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
   |
   = help: the trait `std::fmt::Debug` is not implemented for `<U as httpapi::WebDriverExtensionRoute>::Command`
   = help: consider adding a `where <U as httpapi::WebDriverExtensionRoute>::Command: std::fmt::Debug` bound
   = note: required because of the requirements on the impl of `std::fmt::Debug` for `command::WebDriverMessage<U>`
   = note: required because of the requirements on the impl of `std::fmt::Debug` for `&command::WebDriverMessage<U>`
   = note: required for the cast to the object type `std::fmt::Debug`

@andreastt or @jgraham has one of you an idea? If not we might want to leave this enum alone for now. For every else enum and struct I got the debug added.

For debugging purposes it is helpful when enum and struct
definitions are using derive Debug.
@whimboo
Copy link
Collaborator Author

whimboo commented Aug 8, 2017

For details also see the last failures in CI:
https://travis-ci.org/mozilla/webdriver-rust/jobs/262158981

@jgraham
Copy link
Member

jgraham commented Aug 8, 2017

You need to add the trait bound of Debug to U.

@whimboo
Copy link
Collaborator Author

whimboo commented Aug 8, 2017

So WebDriverExtensionRoute is itself a trait:
https://github.com/mozilla/webdriver-rust/blob/master/src/httpapi.rs#L139

I can see that Clone + Send + PartialEq is used here, but adding Debug doesn't work.

Which line of code actually needs this update?

@whimboo
Copy link
Collaborator Author

whimboo commented Aug 8, 2017

I talked with @jgraham on IRC and we decided to leave the remaining case alone for now. Reason is that it would require updates on various other places which don't seem to be worthwhile right now.

Can someone please do another review of the latest changes please?

@jgraham jgraham merged commit 989cfcb into mozilla:master Aug 8, 2017
@whimboo whimboo deleted the derive branch August 8, 2017 10:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants