From e01d8c1ad193df010be299254f2c2568544b32d0 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 19 Aug 2019 16:53:27 -0600 Subject: [PATCH] Implement Default for FdSet --- CHANGELOG.md | 3 +++ src/sys/select.rs | 6 ++++++ src/sys/socket/mod.rs | 2 ++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 187f16449a..d5a0d66b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - ReleaseDate ### Added +- Implemented `Default` for `FdSet` + ([#TODO](https://github.com/nix-rust/nix/pull/TODO)) + - Added `NixPath::is_empty`. ([#TODO](https://github.com/nix-rust/nix/pull/TODO)) diff --git a/src/sys/select.rs b/src/sys/select.rs index 1b518e29f6..9d60ffaf66 100644 --- a/src/sys/select.rs +++ b/src/sys/select.rs @@ -69,6 +69,12 @@ impl FdSet { } } +impl Default for FdSet { + fn default() -> Self { + Self::new() + } +} + /// Monitors file descriptors for readiness /// /// Returns the total number of ready file descriptors in all sets. The sets are changed so that all diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 8dc8a5caff..662d880353 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -344,6 +344,8 @@ impl CmsgSpace { /// Create a CmsgSpace. The structure is used only for space, so /// the fields are uninitialized. #[deprecated( since="0.14.0", note="Use the cmsg_space! macro instead")] + // It's deprecated anyway; no sense adding Default + #[allow(clippy::new_without_default)] pub fn new() -> Self { // Safe because the fields themselves aren't accessible. unsafe { mem::uninitialized() }