Browse Source

Remove the `use_` prefix from feature names.

I haven't realized that a feature `log` with an optional crate
dependency `log` activates that dependency, and added the prefix
to avoid a "clash". This is unnecessary.
whitequark 8 years ago
parent
commit
a155269d3d
8 changed files with 34 additions and 35 deletions
  1. 5 5
      .travis.yml
  2. 5 6
      Cargo.toml
  3. 8 8
      README.md
  4. 2 2
      src/iface/arp_cache.rs
  5. 7 7
      src/lib.rs
  6. 5 5
      src/phy/mod.rs
  7. 1 1
      src/phy/tracer.rs
  8. 1 1
      src/socket/set.rs

+ 5 - 5
.travis.yml

@@ -2,15 +2,15 @@ language: rust
 matrix:
   include:
     - rust: stable
-      env: FEATURES='use_std' MODE='test'
+      env: FEATURES='std' MODE='test'
     - rust: beta
-      env: FEATURES='use_std' MODE='test'
+      env: FEATURES='std' MODE='test'
     - rust: nightly
-      env: FEATURES='use_std' MODE='test'
+      env: FEATURES='std' MODE='test'
     - rust: nightly
-      env: FEATURES='use_std use_log' MODE='test'
+      env: FEATURES='std log' MODE='test'
     - rust: nightly
-      env: FEATURES='use_alloc use_collections' MODE='build'
+      env: FEATURES='alloc collections' MODE='build'
     - rust: nightly
       env: FEATURES='' MODE='build'
   allow_failures:

+ 5 - 6
Cargo.toml

@@ -12,7 +12,7 @@ license = "0BSD"
 
 [dependencies]
 byteorder = { version = "1.0", default-features = false }
-managed = { version = "0.2.1", default-features = false }
+managed = { version = "0.3.0", default-features = false }
 log = { version = "0.3", default-features = false, optional = true }
 libc = { version = "0.2.18", optional = true }
 
@@ -22,12 +22,11 @@ env_logger = "0.4"
 getopts = "0.2"
 
 [features]
-use_std = ["managed/use_std", "libc"]
-use_alloc = ["managed/use_alloc"]
-use_collections = ["managed/use_collections"]
-use_log = ["log"]
+std = ["managed/std", "libc"]
+alloc = ["managed/alloc"]
+collections = ["managed/collections"]
 verbose = []
-default = ["use_std", "use_log", "verbose"]
+default = ["std", "log", "verbose"]
 
 [[example]]
 name = "tcpdump"

+ 8 - 8
README.md

@@ -82,27 +82,27 @@ You probably want to disable default features and configure them one by one:
 smoltcp = { version = ..., default-features = false, features = [...] }
 ```
 
-### Feature `use_std`
+### Feature `std`
 
-The `use_std` feature enables use of objects and slices owned by the networking stack through a
+The `std` feature enables use of objects and slices owned by the networking stack through a
 dependency on `std::boxed::Box` and `std::vec::Vec`. It also enables `smoltcp::phy::RawSocket`
 and `smoltcp::phy::TapInterface`, if the platform supports it.
 
 This feature is enabled by default.
 
-### Feature `use_alloc`
+### Feature `alloc`
 
-The `use_alloc` feature enables use of objects owned by the networking stack through a dependency
+The `alloc` feature enables use of objects owned by the networking stack through a dependency
 on `alloc::boxed::Box`. This only works on nightly rustc.
 
-### Feature `use_collections`
+### Feature `collections`
 
-The `use_collections` feature enables use of slices owned by the networking stack through a dependency
+The `collections` feature enables use of slices owned by the networking stack through a dependency
 on `collections::vec::Vec`. This only works on nightly rustc.
 
-### Feature `use_log`
+### Feature `log`
 
-The `use_log` feature enables logging of events within the networking stack through
+The `log` feature enables logging of events within the networking stack through
 the [log crate][log]. The events are emitted with the TRACE log level.
 
 [log]: https://crates.io/crates/log

+ 2 - 2
src/iface/arp_cache.rs

@@ -67,12 +67,12 @@ impl<'a> SliceCache<'a> {
 
     /// Sort entries in an order suitable for `find`.
     fn sort(&mut self) {
-        #[cfg(feature = "use_std")]
+        #[cfg(feature = "std")]
         fn sort(data: &mut [(IpAddress, EthernetAddress, usize)]) {
             data.sort_by_key(|&(key, _, _)| key)
         }
 
-        #[cfg(not(feature = "use_std"))]
+        #[cfg(not(feature = "std"))]
         fn sort(data: &mut [(IpAddress, EthernetAddress, usize)]) {
             // Use an insertion sort, which performs best on 10 elements and less.
             for i in 1..data.len() {

+ 7 - 7
src/lib.rs

@@ -1,4 +1,4 @@
-#![cfg_attr(feature = "use_alloc", feature(alloc))]
+#![cfg_attr(feature = "alloc", feature(alloc))]
 #![no_std]
 
 //! The _smoltcp_ library is built in a layered structure, with the layers corresponding
@@ -69,22 +69,22 @@
 
 extern crate byteorder;
 extern crate managed;
-#[cfg(any(test, feature = "use_std"))]
+#[cfg(any(test, feature = "std"))]
 #[macro_use]
 extern crate std;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "std")]
 extern crate libc;
-#[cfg(feature = "use_alloc")]
+#[cfg(feature = "alloc")]
 extern crate alloc;
-#[cfg(any(test, feature = "use_log"))]
+#[cfg(any(test, feature = "log"))]
 #[macro_use(trace, log)]
 extern crate log;
 
 macro_rules! net_trace {
     ($($arg:expr),*) => {
-        #[cfg(feature = "use_log")]
+        #[cfg(feature = "log")]
         trace!($($arg),*);
-        #[cfg(not(feature = "use_log"))]
+        #[cfg(not(feature = "log"))]
         $( let _ = $arg );*; // suppress unused variable warnings
     }
 }

+ 5 - 5
src/phy/mod.rs

@@ -97,21 +97,21 @@ impl Drop for EthernetTxBuffer {
 
 use Error;
 
-#[cfg(feature = "use_std")]
+#[cfg(feature = "std")]
 mod sys;
 
 mod tracer;
 mod fault_injector;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "std")]
 mod raw_socket;
-#[cfg(all(feature = "use_std", target_os = "linux"))]
+#[cfg(all(feature = "std", target_os = "linux"))]
 mod tap_interface;
 
 pub use self::tracer::Tracer;
 pub use self::fault_injector::FaultInjector;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "std")]
 pub use self::raw_socket::RawSocket;
-#[cfg(all(feature = "use_std", target_os = "linux"))]
+#[cfg(all(feature = "std", target_os = "linux"))]
 pub use self::tap_interface::TapInterface;
 
 /// An interface for sending and receiving raw network frames.

+ 1 - 1
src/phy/tracer.rs

@@ -21,7 +21,7 @@ impl<T: Device, U: PrettyPrint> Tracer<T, U> {
     }
 
     /// Create a tracer device, printing to standard output.
-    #[cfg(feature = "use_std")]
+    #[cfg(feature = "std")]
     pub fn new_stdout(lower: T) -> Tracer<T, U> {
         fn writer<U: PrettyPrint>(printer: PrettyPrinter<U>) {
             print!("{}", printer)

+ 1 - 1
src/socket/set.rs

@@ -61,7 +61,7 @@ impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c> {
             ManagedSlice::Borrowed(_) => {
                 panic!("adding a socket to a full SocketSet")
             }
-            #[cfg(any(feature = "use_std", feature = "use_collections"))]
+            #[cfg(any(feature = "std", feature = "collections"))]
             ManagedSlice::Owned(ref mut sockets) => {
                 sockets.push(None);
                 let index = sockets.len() - 1;