Contribute a small example for how to use SockAddrStorage::view_as#615
Merged
Darksonn merged 2 commits intorust-lang:masterfrom Oct 11, 2025
Merged
Contribute a small example for how to use SockAddrStorage::view_as#615Darksonn merged 2 commits intorust-lang:masterfrom
Darksonn merged 2 commits intorust-lang:masterfrom
Conversation
Darksonn
reviewed
Oct 2, 2025
| /// | ||
| /// # Examples | ||
| /// ``` | ||
| /// # #[allow(dead_code)] |
Member
There was a problem hiding this comment.
I'm pretty sure dead-code warnings are disabled by default in documentation tests.
Contributor
Author
There was a problem hiding this comment.
@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?
Member
There was a problem hiding this comment.
Oh, there is a #![doc(test(attr(deny(warnings))))] in socket2. I didn't know about that. It's because of that.
Thomasdezeeuw
approved these changes
Oct 7, 2025
Collaborator
|
Thanks @shaun-cox, I'll sort out the CI another pr. |
Collaborator
|
@shaun-cox can you rebase the pr? It should fix the CI issues |
Contributor
Author
|
@Thomasdezeeuw, rebase is done. Thanks. |
This file contains hidden or 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
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.
In order to help demonstrate how to create a
SockAddrfrom 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.