Skip to content

Commit

Permalink
Merge pull request #34 from ds-cbo/bump-bitflags
Browse files Browse the repository at this point in the history
Bump bitflags dependency by major version to 2
  • Loading branch information
Gilnaa authored Dec 20, 2023
2 parents 5fc8184 + b0e102d commit d940533
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 30 deletions.
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ license = "MIT"
repository = "https://github.com/gilnaa/globwalk"
categories = ["filesystem"]
keywords = ["regex", "glob", "pattern", "walk", "iterator"]
edition = "2021"
resolver = "2"

[badges]
travis-ci = { repository = "Gilnaa/globwalk" }
Expand All @@ -16,12 +18,8 @@ appveyor = { repository = "Gilnaa/globwalk" }
[dependencies]
walkdir = "2"
ignore = "0.4.11"
bitflags = "1.2"
bitflags = "2"

[dev-dependencies]
tempfile = "3"
docmatic = "0.1.2"

# We're not using backtrace, really. It is just a deep dependency of docmatic.
# Locking down its version so that we can compile the tests using rustc 1.31.0
backtrace = "=0.3.35"
2 changes: 0 additions & 2 deletions examples/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

extern crate globwalk;

use globwalk::GlobWalkerBuilder;
use std::env::args;

Expand Down
6 changes: 2 additions & 4 deletions src/doctests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
extern crate tempfile;

use std::error::Error;
use std::fs::{File, create_dir_all};
use std::fs::{create_dir_all, File};
use std::path::PathBuf;
use tempfile::TempDir;

fn create_files(files: &[&str]) -> Result<TempDir, Box<Error>> {
fn create_files(files: &[&str]) -> Result<TempDir, Box<dyn Error>> {
let tmp_dir = TempDir::new()?;

for f in files {
Expand Down
23 changes: 6 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//! # include!("doctests.rs");
//!
//! use std::fs;
//! # fn run() -> Result<(), Box<::std::error::Error>> {
//! # fn run() -> Result<(), Box<dyn ::std::error::Error>> {
//! # let temp_dir = create_files(&["cow.jog", "cat.gif"])?;
//! # ::std::env::set_current_dir(&temp_dir)?;
//!
Expand All @@ -60,7 +60,7 @@
//!
//! use std::fs;
//!
//! # fn run() -> Result<(), Box<::std::error::Error>> {
//! # fn run() -> Result<(), Box<dyn ::std::error::Error>> {
//! # let temp_dir = create_files(&["cow.jog", "cat.gif"])?;
//! # let BASE_DIR = &temp_dir;
//! let walker = globwalk::GlobWalkerBuilder::from_patterns(
Expand All @@ -84,13 +84,6 @@
#![allow(clippy::needless_doctest_main)]
#![warn(missing_docs)]

extern crate ignore;
extern crate walkdir;

extern crate bitflags;
#[cfg(test)]
extern crate tempfile;

use ignore::overrides::{Override, OverrideBuilder};
use ignore::Match;
use std::cmp::Ordering;
Expand Down Expand Up @@ -126,16 +119,12 @@ impl From<GlobError> for std::io::Error {
}

impl std::fmt::Display for GlobError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
self.0.fmt(f)
}
}

impl std::error::Error for GlobError {
fn description(&self) -> &str {
self.0.description()
}
}
impl std::error::Error for GlobError {}

bitflags::bitflags! {
/// Possible file type filters.
Expand Down Expand Up @@ -379,7 +368,7 @@ impl Iterator for GlobWalker {
None
};

let file_type_matches = match (self.file_type_filter, file_type) {
let file_type_matches = match (self.file_type_filter.as_ref(), file_type) {
(None, _) => true,
(Some(_), None) => false,
(Some(filter), Some(actual)) => filter.contains(actual),
Expand Down Expand Up @@ -455,7 +444,7 @@ pub fn glob_builder<S: AsRef<str>>(pattern: S) -> GlobWalkerBuilder {

let pat = pattern.to_str().unwrap();
if cfg!(windows) {
GlobWalkerBuilder::new(base.to_str().unwrap(), pat.replace("\\", "/"))
GlobWalkerBuilder::new(base.to_str().unwrap(), pat.replace('\\', "/"))
} else {
GlobWalkerBuilder::new(base.to_str().unwrap(), pat)
}
Expand Down
2 changes: 0 additions & 2 deletions tests/docs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate docmatic;

#[test]
fn readme_test() {
let readme = std::path::Path::new(file!()).canonicalize().unwrap();
Expand Down

0 comments on commit d940533

Please sign in to comment.