This repository has been archived by the owner on Mar 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reformat toml & some fixes * CI checks `default-features` * fix as suggestion * format output
- Loading branch information
Xavier Lau
authored
Jul 16, 2021
1 parent
3ae2ed7
commit 604080a
Showing
72 changed files
with
691 additions
and
783 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
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 |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
|
||
# Package Manager | ||
## cargo | ||
/target | ||
target | ||
## npm | ||
node_modules |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
edition = "2018" | ||
name = "check-default-features" | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
cargo_toml = { version = "0.9.2" } | ||
walkdir = { version = "2.3.2" } |
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,54 @@ | ||
// --- std --- | ||
use std::{env, process}; | ||
// --- crates.io --- | ||
use cargo_toml::Manifest; | ||
use walkdir::WalkDir; | ||
|
||
fn main() { | ||
let mut incomplete_dependencies = vec![]; | ||
|
||
for e in WalkDir::new(env::current_dir().unwrap()) | ||
.into_iter() | ||
.filter_entry(|e| { | ||
let n = e.file_name().to_str().unwrap(); | ||
|
||
n != "target" && !(n.starts_with('.') && !n.starts_with("./")) | ||
}) | ||
.filter_map(|e| e.ok()) | ||
{ | ||
if e.file_name() == "Cargo.toml" { | ||
let manifest = Manifest::from_path(e.path()).unwrap(); | ||
|
||
if let Some(std) = manifest.features.get("std") { | ||
for (alias, dependency) in manifest.dependencies.iter() { | ||
if let Some(detail) = dependency.detail() { | ||
if let Some(default_features) = detail.default_features { | ||
if !default_features { | ||
if !std.contains(&format!("{}/std", alias)) { | ||
incomplete_dependencies.push(( | ||
alias.to_owned(), | ||
e.path() | ||
.to_str() | ||
.unwrap() | ||
.split("common/") | ||
.last() | ||
.unwrap() | ||
.to_owned(), | ||
)); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if !incomplete_dependencies.is_empty() { | ||
for (alias, path) in incomplete_dependencies { | ||
println!("Incomplete std feature found for `{}` at `{}`", alias, path); | ||
} | ||
|
||
process::exit(1); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.