Skip to content

Commit df92ace

Browse files
committed
Switch to the 2018 edition
1 parent 5f7eff0 commit df92ace

File tree

6 files changed

+19
-21
lines changed

6 files changed

+19
-21
lines changed

enumflags/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repository = "https://github.com/NieDzejkob/enumflags2"
88
readme = "../README.md"
99
keywords = ["enum", "bitflag", "flag", "bitflags"]
1010
documentation = "https://docs.rs/enumflags2"
11+
edition = "2018"
1112

1213
[dependencies.enumflags2_derive]
1314
version = "0.6.3"

enumflags/src/fallible.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<T: RawBitFlags> FromBitsError<T> {
6767
}
6868

6969
impl<T: RawBitFlags + fmt::Debug> fmt::Display for FromBitsError<T> {
70-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
70+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
7171
write!(fmt, "Invalid bits for {:?}: {:#b}", self.flags, self.invalid)
7272
}
7373
}

enumflags/src/formatting.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ impl<T> fmt::Debug for BitFlags<T>
55
where
66
T: RawBitFlags + fmt::Debug,
77
{
8-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
8+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
99
let name = T::bitflags_type_name();
1010
let bits = DebugBinaryFormatter(&self.val);
1111
let iter = if !self.is_empty() {
@@ -40,7 +40,7 @@ where
4040
T: RawBitFlags,
4141
T::Type: fmt::Binary,
4242
{
43-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
43+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
4444
fmt::Binary::fmt(&self.bits(), fmt)
4545
}
4646
}
@@ -50,7 +50,7 @@ where
5050
T: RawBitFlags,
5151
T::Type: fmt::Octal,
5252
{
53-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
53+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
5454
fmt::Octal::fmt(&self.bits(), fmt)
5555
}
5656
}
@@ -60,7 +60,7 @@ where
6060
T: RawBitFlags,
6161
T::Type: fmt::LowerHex,
6262
{
63-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
63+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
6464
fmt::LowerHex::fmt(&self.bits(), fmt)
6565
}
6666
}
@@ -70,7 +70,7 @@ where
7070
T: RawBitFlags,
7171
T::Type: fmt::UpperHex,
7272
{
73-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
73+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
7474
fmt::UpperHex::fmt(&self.bits(), fmt)
7575
}
7676
}
@@ -79,7 +79,7 @@ where
7979
struct FlagFormatter<I>(I);
8080

8181
impl<T: Debug, I: Clone + Iterator<Item=T>> Debug for FlagFormatter<I> {
82-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
82+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
8383
let mut iter = self.0.clone();
8484
if let Some(val) = iter.next() {
8585
Debug::fmt(&val, fmt)?;
@@ -101,7 +101,7 @@ impl<T: Debug, I: Clone + Iterator<Item=T>> Debug for FlagFormatter<I> {
101101
struct DebugBinaryFormatter<'a, F>(&'a F);
102102

103103
impl<'a, F: Debug + Binary + 'a> Debug for DebugBinaryFormatter<'a, F> {
104-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
104+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
105105
// Check if {:x?} or {:X?} was used; this is determined via the
106106
// discriminator of core::fmt::FlagV1::{DebugLowerHex, DebugUpperHex},
107107
// which is not an accessible type: https://github.com/rust-lang/rust/blob/d65e272a9fe3e61aa5f229c5358e35a909435575/src/libcore/fmt/mod.rs#L306

enumflags/src/lib.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@
8787
#![warn(missing_docs)]
8888
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
8989

90-
#[cfg(any(test, feature = "std"))]
91-
extern crate core;
9290
use core::{cmp, ops};
9391
use core::iter::FromIterator;
9492

@@ -131,9 +129,9 @@ pub mod _internal {
131129
}
132130
}
133131

134-
use core::ops::{BitAnd, BitOr, BitXor, Not};
135-
use core::cmp::PartialOrd;
136-
use core::fmt;
132+
use ::core::ops::{BitAnd, BitOr, BitXor, Not};
133+
use ::core::cmp::PartialOrd;
134+
use ::core::fmt;
137135

138136
pub trait BitFlagNum
139137
: Default
@@ -165,7 +163,7 @@ mod formatting;
165163

166164
// impl TryFrom<T::Type> for BitFlags<T>
167165
mod fallible;
168-
pub use fallible::FromBitsError;
166+
pub use crate::fallible::FromBitsError;
169167

170168
/// Represents a set of flags of some type `T`.
171169
/// The type must have the `#[derive(BitFlags)]` attribute applied.
@@ -390,9 +388,8 @@ where
390388

391389
#[cfg(feature = "serde")]
392390
mod impl_serde {
393-
extern crate serde;
394-
use self::serde::{Serialize, Deserialize};
395-
use self::serde::de::{Error, Unexpected};
391+
use serde::{Serialize, Deserialize};
392+
use serde::de::{Error, Unexpected};
396393
use super::{BitFlags, RawBitFlags};
397394

398395
impl<'a, T> Deserialize<'a> for BitFlags<T>

enumflags_derive/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description = "Do not use directly, use the reexport in the `enumflags2` crate.
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/NieDzejkob/enumflags2"
88
keywords = ["enum", "bitflag", "flag", "bitflags"]
9+
edition = "2018"
910

1011
[lib]
1112
proc-macro = true

enumflags_derive/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
extern crate proc_macro;
33
#[macro_use]
44
extern crate quote;
5-
extern crate syn;
6-
extern crate proc_macro2;
5+
76
use syn::{Data, Ident, DeriveInput, DataEnum, spanned::Spanned};
87
use proc_macro2::TokenStream;
98
use proc_macro2::Span;
@@ -43,7 +42,7 @@ enum EvaluationError {
4342

4443
impl From<EvaluationError> for TokenStream {
4544
fn from(why: EvaluationError) -> TokenStream {
46-
use EvaluationError::*;
45+
use crate::EvaluationError::*;
4746

4847
match why {
4948
LiteralOutOfRange(span) => {
@@ -65,7 +64,7 @@ impl From<EvaluationError> for TokenStream {
6564
/// Try to evaluate the expression given.
6665
fn fold_expr(expr: &syn::Expr) -> Result<u64, EvaluationError> {
6766
use syn::Expr;
68-
use EvaluationError::*;
67+
use crate::EvaluationError::*;
6968
match expr {
7069
Expr::Lit(ref expr_lit) => {
7170
match expr_lit.lit {

0 commit comments

Comments
 (0)