Skip to content

Commit

Permalink
Unify case convention for feature names
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored and cramertj committed Nov 4, 2019
1 parent 5eaf178 commit b978018
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 56 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Expand Up @@ -18,9 +18,9 @@ matrix:
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
# Check default-features
- cargo build --all
# Check compat & threadpool features
# Check compat & thread-pool features
- cargo build --manifest-path futures/Cargo.toml --features io-compat
- cargo build --manifest-path futures/Cargo.toml --features threadpool
- cargo build --manifest-path futures/Cargo.toml --features thread-pool

# This is the minimum Rust version supported by `async-await` feature.
# When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.
Expand All @@ -36,19 +36,19 @@ matrix:
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
# Check default-features
- cargo build --all
# Check compat & threadpool features
# Check compat & thread-pool features
- cargo build --manifest-path futures/Cargo.toml --features io-compat
- cargo build --manifest-path futures/Cargo.toml --features threadpool
- cargo build --manifest-path futures/Cargo.toml --features thread-pool

- name: cargo +beta build
rust: beta
script:
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
# Check default-features
- cargo build --all
# Check compat & threadpool & async-await features
# Check compat & thread-pool & async-await features
- cargo build --manifest-path futures/Cargo.toml --features io-compat
- cargo build --manifest-path futures/Cargo.toml --features threadpool
- cargo build --manifest-path futures/Cargo.toml --features thread-pool
- cargo build --manifest-path futures/Cargo.toml --features async-await

- name: cargo test
Expand Down Expand Up @@ -153,7 +153,7 @@ matrix:
- cargo check --manifest-path futures-io/Cargo.toml
- cargo check --manifest-path futures-io/Cargo.toml --all-features
# Check each features
- cargo check --manifest-path futures-io/Cargo.toml --features read_initializer,unstable
- cargo check --manifest-path futures-io/Cargo.toml --features read-initializer,unstable

# futures-util
# Check default-features, all-features
Expand All @@ -173,7 +173,7 @@ matrix:
- cargo check --manifest-path futures-util/Cargo.toml --features sink,bilock,unstable
- cargo check --manifest-path futures-util/Cargo.toml --features io,bilock,unstable
- cargo check --manifest-path futures-util/Cargo.toml --features sink,io
- cargo check --manifest-path futures-util/Cargo.toml --features read_initializer,unstable
- cargo check --manifest-path futures-util/Cargo.toml --features read-initializer,unstable
# Check each features with --no-default-features
- cargo check --manifest-path futures-util/Cargo.toml --no-default-features
- cargo check --manifest-path futures-util/Cargo.toml --no-default-features --features sink
Expand All @@ -188,7 +188,7 @@ matrix:
- cargo check --manifest-path futures-executor/Cargo.toml
- cargo check --manifest-path futures-executor/Cargo.toml --all-features
# Check each features
- cargo check --manifest-path futures-executor/Cargo.toml --features threadpool
- cargo check --manifest-path futures-executor/Cargo.toml --features thread-pool

- name: cargo doc
rust: nightly
Expand Down
2 changes: 1 addition & 1 deletion futures-executor/Cargo.toml
Expand Up @@ -17,7 +17,7 @@ name = "futures_executor"
[features]
default = ["std"]
std = ["futures-core-preview/std", "futures-util-preview/std"]
threadpool = ["num_cpus"]
thread-pool = ["num_cpus"]

[dependencies]
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.19", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions futures-executor/src/lib.rs
Expand Up @@ -19,13 +19,13 @@ mod local_pool;
#[cfg(feature = "std")]
pub use crate::local_pool::{block_on, block_on_stream, BlockingStream, LocalPool, LocalSpawner};

#[cfg(feature = "threadpool")]
#[cfg(feature = "thread-pool")]
#[cfg(feature = "std")]
mod unpark_mutex;
#[cfg(feature = "threadpool")]
#[cfg(feature = "thread-pool")]
#[cfg(feature = "std")]
mod thread_pool;
#[cfg(feature = "threadpool")]
#[cfg(feature = "thread-pool")]
#[cfg(feature = "std")]
pub use crate::thread_pool::{ThreadPool, ThreadPoolBuilder};

Expand Down
4 changes: 2 additions & 2 deletions futures-executor/src/thread_pool.rs
Expand Up @@ -21,15 +21,15 @@ use std::thread;
/// This type is a clonable handle to the threadpool itself.
/// Cloning it will only create a new reference, not a new threadpool.
///
/// This type is only available when the `threadpool` feature of this
/// This type is only available when the `thread-pool` feature of this
/// library is activated.
pub struct ThreadPool {
state: Arc<PoolState>,
}

/// Thread pool configuration object.
///
/// This type is only available when the `threadpool` feature of this
/// This type is only available when the `thread-pool` feature of this
/// library is activated.
pub struct ThreadPoolBuilder {
pool_size: usize,
Expand Down
2 changes: 1 addition & 1 deletion futures-io/Cargo.toml
Expand Up @@ -22,6 +22,6 @@ std = []
# These features are outside of the normal semver guarantees and require the
# `unstable` feature as an explicit opt-in to unstable API.
unstable = []
read_initializer = []
read-initializer = []

[dependencies]
16 changes: 8 additions & 8 deletions futures-io/src/lib.rs
Expand Up @@ -8,7 +8,7 @@
//! All items of this library are only available when the `std` feature of this
//! library is activated, and it is activated by default.

#![cfg_attr(feature = "read_initializer", feature(read_initializer))]
#![cfg_attr(feature = "read-initializer", feature(read_initializer))]

#![cfg_attr(not(feature = "std"), no_std)]

Expand All @@ -21,8 +21,8 @@

#![doc(html_root_url = "https://docs.rs/futures-io-preview/0.3.0-alpha.19")]

#[cfg(all(feature = "read_initializer", not(feature = "unstable")))]
compile_error!("The `read_initializer` feature requires the `unstable` feature as an explicit opt-in to unstable features");
#[cfg(all(feature = "read-initializer", not(feature = "unstable")))]
compile_error!("The `read-initializer` feature requires the `unstable` feature as an explicit opt-in to unstable features");

#[cfg(feature = "std")]
mod if_std {
Expand All @@ -43,7 +43,7 @@ mod if_std {
SeekFrom as SeekFrom,
};

#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use io::Initializer as Initializer;

Expand All @@ -66,7 +66,7 @@ mod if_std {
/// This method is `unsafe` because and `AsyncRead`er could otherwise
/// return a non-zeroing `Initializer` from another `AsyncRead` type
/// without an `unsafe` block.
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
#[inline]
unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing()
Expand Down Expand Up @@ -310,7 +310,7 @@ mod if_std {

macro_rules! deref_async_read {
() => {
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
(**self).initializer()
}
Expand Down Expand Up @@ -342,7 +342,7 @@ mod if_std {
P: DerefMut + Unpin,
P::Target: AsyncRead,
{
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
(**self).initializer()
}
Expand All @@ -362,7 +362,7 @@ mod if_std {

macro_rules! delegate_async_read_to_stdio {
() => {
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
io::Read::initializer(self)
}
Expand Down
2 changes: 1 addition & 1 deletion futures-util/Cargo.toml
Expand Up @@ -32,7 +32,7 @@ channel = ["std", "futures-channel-preview"]
unstable = ["futures-core-preview/unstable"]
cfg-target-has-atomic = ["futures-core-preview/cfg-target-has-atomic"]
bilock = []
read_initializer = ["io", "futures-io-preview/read_initializer", "futures-io-preview/unstable"]
read-initializer = ["io", "futures-io-preview/read-initializer", "futures-io-preview/unstable"]

[dependencies]
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.19", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/compat/compat01as03.rs
Expand Up @@ -368,7 +368,7 @@ unsafe impl UnsafeNotify01 for NotifyWaker {
#[cfg(feature = "io-compat")]
mod io {
use super::*;
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead as AsyncRead03, AsyncWrite as AsyncWrite03};
use std::io::Error;
Expand Down Expand Up @@ -433,7 +433,7 @@ mod io {
impl<W: AsyncWrite01> AsyncWrite01CompatExt for W {}

impl<R: AsyncRead01> AsyncRead03 for Compat01As03<R> {
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
// check if `prepare_uninitialized_buffer` needs zeroing
if self.inner.get_ref().prepare_uninitialized_buffer(&mut [1]) {
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/compat/compat03as01.rs
Expand Up @@ -262,7 +262,7 @@ mod io {
}

impl<R: AsyncRead03 + Unpin> AsyncRead01 for Compat<R> {
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool {
let initializer = self.inner.initializer();
let does_init = initializer.should_initialize();
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/future/either.rs
Expand Up @@ -160,7 +160,7 @@ mod if_std {
use super::Either;
use core::pin::Pin;
use core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{
AsyncBufRead, AsyncRead, AsyncSeek, AsyncWrite, IoSlice, IoSliceMut, Result, SeekFrom,
Expand All @@ -171,7 +171,7 @@ mod if_std {
A: AsyncRead,
B: AsyncRead,
{
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
match self {
Either::Left(x) => x.initializer(),
Expand Down
6 changes: 3 additions & 3 deletions futures-util/src/io/allow_std.rs
@@ -1,5 +1,5 @@
use futures_core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead, IoSlice, IoSliceMut, SeekFrom};
use std::{fmt, io};
Expand Down Expand Up @@ -108,7 +108,7 @@ impl<T> io::Read for AllowStdIo<T> where T: io::Read {
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
self.0.read_vectored(bufs)
}
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
self.0.initializer()
}
Expand Down Expand Up @@ -136,7 +136,7 @@ impl<T> AsyncRead for AllowStdIo<T> where T: io::Read {
Poll::Ready(Ok(try_with_interrupt!(self.0.read_vectored(bufs))))
}

#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
self.0.initializer()
}
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/io/buf_reader.rs
@@ -1,5 +1,5 @@
use futures_core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncBufRead, AsyncRead, AsyncSeek, IoSliceMut, SeekFrom};
use pin_utils::{unsafe_pinned, unsafe_unpinned};
Expand Down Expand Up @@ -168,7 +168,7 @@ impl<R: AsyncRead> AsyncRead for BufReader<R> {
}

// we can't skip unconditionally because of the large buffer case in read.
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer()
}
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/io/chain.rs
@@ -1,5 +1,5 @@
use futures_core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncBufRead, AsyncRead, IoSliceMut};
use pin_utils::{unsafe_pinned, unsafe_unpinned};
Expand Down Expand Up @@ -119,7 +119,7 @@ where
self.second().poll_read_vectored(cx, bufs)
}

#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
let initializer = self.first.initializer();
if initializer.should_initialize() {
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/io/empty.rs
@@ -1,5 +1,5 @@
use futures_core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncBufRead, AsyncRead};
use std::fmt;
Expand Down Expand Up @@ -44,7 +44,7 @@ impl AsyncRead for Empty {
Poll::Ready(Ok(0))
}

#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
#[inline]
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
Expand Down
6 changes: 3 additions & 3 deletions futures-util/src/io/mod.rs
Expand Up @@ -17,7 +17,7 @@ pub use futures_io::{
AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead, Error, ErrorKind,
IoSlice, IoSliceMut, Result, SeekFrom,
};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
pub use futures_io::Initializer;

// used by `BufReader` and `BufWriter`
Expand All @@ -26,10 +26,10 @@ const DEFAULT_BUF_SIZE: usize = 8 * 1024;

/// Initializes a buffer if necessary.
///
/// A buffer is always initialized if `read_initializer` feature is disabled.
/// A buffer is always initialized if `read-initializer` feature is disabled.
#[inline]
unsafe fn initialize<R: AsyncRead>(_reader: &R, buf: &mut [u8]) {
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
{
if !_reader.initializer().should_initialize() {
return;
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/io/repeat.rs
@@ -1,5 +1,5 @@
use futures_core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead, IoSliceMut};
use std::fmt;
Expand Down Expand Up @@ -59,7 +59,7 @@ impl AsyncRead for Repeat {
Poll::Ready(Ok(nwritten))
}

#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
#[inline]
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/io/take.rs
@@ -1,5 +1,5 @@
use futures_core::task::{Context, Poll};
#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead, AsyncBufRead};
use pin_utils::{unsafe_pinned, unsafe_unpinned};
Expand Down Expand Up @@ -185,7 +185,7 @@ impl<R: AsyncRead> AsyncRead for Take<R> {
Poll::Ready(Ok(n))
}

#[cfg(feature = "read_initializer")]
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer()
}
Expand Down
6 changes: 3 additions & 3 deletions futures-util/src/lib.rs
Expand Up @@ -2,7 +2,7 @@
//! and the `AsyncRead` and `AsyncWrite` traits.

#![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))]
#![cfg_attr(feature = "read_initializer", feature(read_initializer))]
#![cfg_attr(feature = "read-initializer", feature(read_initializer))]

#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
Expand All @@ -20,8 +20,8 @@ compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feat
#[cfg(all(feature = "bilock", not(feature = "unstable")))]
compile_error!("The `bilock` feature requires the `unstable` feature as an explicit opt-in to unstable features");

#[cfg(all(feature = "read_initializer", not(feature = "unstable")))]
compile_error!("The `read_initializer` feature requires the `unstable` feature as an explicit opt-in to unstable features");
#[cfg(all(feature = "read-initializer", not(feature = "unstable")))]
compile_error!("The `read-initializer` feature requires the `unstable` feature as an explicit opt-in to unstable features");

#[cfg(feature = "alloc")]
extern crate alloc;
Expand Down
4 changes: 2 additions & 2 deletions futures/Cargo.toml
Expand Up @@ -42,15 +42,15 @@ alloc = ["futures-core-preview/alloc", "futures-sink-preview/alloc", "futures-ch
async-await = ["futures-util-preview/async-await", "futures-util-preview/async-await-macro"]
compat = ["std", "futures-util-preview/compat"]
io-compat = ["compat", "futures-util-preview/io-compat"]
threadpool = ["futures-executor-preview/threadpool"]
thread-pool = ["futures-executor-preview/thread-pool"]

# Unstable features
# These features are outside of the normal semver guarantees and require the
# `unstable` feature as an explicit opt-in to unstable API.
unstable = ["futures-core-preview/unstable", "futures-channel-preview/unstable", "futures-io-preview/unstable", "futures-util-preview/unstable"]
cfg-target-has-atomic = ["futures-core-preview/cfg-target-has-atomic", "futures-channel-preview/cfg-target-has-atomic", "futures-util-preview/cfg-target-has-atomic"]
bilock = ["futures-util-preview/bilock"]
read_initializer = ["futures-io-preview/read_initializer", "futures-util-preview/read_initializer"]
read-initializer = ["futures-io-preview/read-initializer", "futures-util-preview/read-initializer"]

[package.metadata.docs.rs]
all-features = true

0 comments on commit b978018

Please sign in to comment.