Skip to content

Commit 4a8edd6

Browse files
committed
Implement Default for FdSet
1 parent 64e9e8f commit 4a8edd6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66
## [Unreleased] - ReleaseDate
77
### Added
88

9+
- Implemented `Default` for `FdSet`
10+
([#1107](https://github.com/nix-rust/nix/pull/1107))
11+
912
- Added `NixPath::is_empty`.
1013
([#1107](https://github.com/nix-rust/nix/pull/1107))
1114

src/sys/select.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ impl FdSet {
6969
}
7070
}
7171

72+
impl Default for FdSet {
73+
fn default() -> Self {
74+
Self::new()
75+
}
76+
}
77+
7278
/// Monitors file descriptors for readiness
7379
///
7480
/// Returns the total number of ready file descriptors in all sets. The sets are changed so that all

src/sys/socket/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ impl<T> CmsgSpace<T> {
344344
/// Create a CmsgSpace<T>. The structure is used only for space, so
345345
/// the fields are uninitialized.
346346
#[deprecated( since="0.14.0", note="Use the cmsg_space! macro instead")]
347+
// It's deprecated anyway; no sense adding Default
348+
#[allow(clippy::new_without_default)]
347349
pub fn new() -> Self {
348350
// Safe because the fields themselves aren't accessible.
349351
unsafe { mem::uninitialized() }

0 commit comments

Comments
 (0)