-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4274 from tgross35/backport-chanterelle
[0.2] Backports
- Loading branch information
Showing
99 changed files
with
951 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
target | ||
Cargo.lock | ||
*~ | ||
style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//! Simple script to verify the coding style of this library. | ||
//! | ||
//! ## How to run | ||
//! | ||
//! The first argument to this script is the directory to run on, so running | ||
//! this script should be as simple as: | ||
//! | ||
//! ```notrust | ||
//! cargo test --test style | ||
//! ``` | ||
pub mod style; | ||
|
||
use std::env; | ||
use std::path::Path; | ||
|
||
use style::{Result, StyleChecker}; | ||
|
||
#[test] | ||
fn check_style() { | ||
let root_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../src"); | ||
walk(&root_dir).unwrap(); | ||
eprintln!("good style!"); | ||
} | ||
|
||
fn walk(root_dir: &Path) -> Result<()> { | ||
let mut style_checker = StyleChecker::new(); | ||
|
||
for entry in glob::glob(&format!( | ||
"{}/**/*.rs", | ||
root_dir.to_str().expect("dir should be valid UTF-8") | ||
))? { | ||
let entry = entry?; | ||
|
||
let name = entry | ||
.file_name() | ||
.expect("file name should not end in ..") | ||
.to_str() | ||
.expect("file name should be valid UTF-8"); | ||
if let "lib.rs" | "macros.rs" = &name[..] { | ||
continue; | ||
} | ||
|
||
let path = entry.as_path(); | ||
style_checker.check_file(path)?; | ||
style_checker.reset_state(); | ||
} | ||
|
||
style_checker.finalize() | ||
} |
Oops, something went wrong.