-
Notifications
You must be signed in to change notification settings - Fork 269
Contribute a small example for how to use SockAddrStorage::view_as #615
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
base: master
Are you sure you want to change the base?
Conversation
See https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint for the tool used to reveal markdown lint
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.
Example LGTM
This reverts commit ea043e3.
/// | ||
/// # Examples | ||
/// ``` | ||
/// # #[allow(dead_code)] |
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.
I'm pretty sure dead-code warnings are disabled by default in documentation tests.
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.
@Darksonn, I'm running cargo test --all-features
locally and seeing this (without the allow(dead_code)
)
---- src/sockaddr.rs - sockaddr::SockAddrStorage::view_as (line 54) stdout ----
error: function `from_sockaddr_storage` is never used
--> src/sockaddr.rs:60:4
|
9 | fn from_sockaddr_storage(recv_address: &sockaddr_storage) -> SockAddr {
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/sockaddr.rs:52:9
|
1 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
error: aborting due to 1 previous error
Couldn't compile the test.
Do I possibly have something misconfigured locally to cause this?
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.
Oh, there is a #![doc(test(attr(deny(warnings))))]
in socket2. I didn't know about that. It's because of that.
Thanks @shaun-cox, I'll sort out the CI another pr. |
@shaun-cox can you rebase the pr? It should fix the CI issues |
In order to help demonstrate how to create a
SockAddr
from an instance of alibc::sockaddr_storage
, @Thomasdezeeuw proposed adding an example in #613.I also took the liberty of addressing a few markdownlint items in the readme and contributing docs... Hope that was okay.