Repository: cross-rs/cross
Pull request #685 (2022-04-07 11:27:52)

Add android libc version
This PR adds libc version of android because bionic is provided as libc on android.
QEMU version is added too.


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bbc967c..362000f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -74,7 +74,7 @@ jobs:
         uses: actions-rs/cargo@v1
         with:
           command: test
-          args: --locked --all-targets --workspace
+          args: --locked
         timeout-minutes: 5
 
   generate-matrix:
diff --git a/.gitignore b/.gitignore
index e333188..1de5659 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,1 @@
-**/target/
-**/.idea/
-**/.vscode/*.*
-**/*.log
-/cargo-timing*.html
\ No newline at end of file
+target
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index e3b216b..ffe034f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -17,15 +17,6 @@ version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
 
-[[package]]
-name = "aho-corasick"
-version = "0.7.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
-dependencies = [
- "memchr",
-]
-
 [[package]]
 name = "atty"
 version = "0.2.14"
@@ -112,17 +103,15 @@ dependencies = [
  "dunce",
  "eyre",
  "home",
+ "lazy_static",
  "libc",
  "nix",
- "once_cell",
- "regex",
  "rustc_version",
  "serde",
  "serde_ignored",
  "serde_json",
  "shell-escape",
  "toml",
- "walkdir",
  "which",
  "winapi",
 ]
@@ -280,23 +269,6 @@ dependencies = [
  "proc-macro2",
 ]
 
-[[package]]
-name = "regex"
-version = "1.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
-
 [[package]]
 name = "rustc-demangle"
 version = "0.1.21"
@@ -318,15 +290,6 @@ version = "1.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
 
-[[package]]
-name = "same-file"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
-dependencies = [
- "winapi-util",
-]
-
 [[package]]
 name = "semver"
 version = "1.0.6"
@@ -471,17 +434,6 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
 
-[[package]]
-name = "walkdir"
-version = "2.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
-dependencies = [
- "same-file",
- "winapi",
- "winapi-util",
-]
-
 [[package]]
 name = "which"
 version = "4.2.4"
@@ -509,15 +461,6 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
-
 [[package]]
 name = "winapi-x86_64-pc-windows-gnu"
 version = "0.4.0"
diff --git a/Cargo.toml b/Cargo.toml
index f765996..14e3ba4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,7 @@ atty = "0.2"
 color-eyre = "0.6"
 eyre = "0.6"
 home = "0.5"
+lazy_static = "1"
 rustc_version = "0.4"
 toml = "0.5"
 which = { version = "4", default_features = false }
@@ -32,8 +33,3 @@ dunce = "1"
 
 [profile.release]
 lto = true
-
-[dev-dependencies]
-regex = "1"
-once_cell = "1"
-walkdir = "2"
diff --git a/README.md b/README.md
index 9ae5418..f44c873 100644
--- a/README.md
+++ b/README.md
@@ -226,7 +226,7 @@ non-standard targets (i.e. something not reported by rustc/rustup). However,
 you can use the `build.xargo` or `target.{{TARGET}}.xargo` field in
 `Cross.toml` to force the use of `xargo`:
 
-```toml
+``` toml
 # all the targets will use `xargo`
 [build]
 xargo = true
@@ -234,7 +234,7 @@ xargo = true
 
 Or,
 
-```toml
+``` toml
 # only this target will use `xargo`
 [target.aarch64-unknown-linux-gnu]
 xargo = true
@@ -264,23 +264,23 @@ terminate.
 | Target                               |  libc  |   GCC   | C++ | QEMU  | `test` |
 |--------------------------------------|-------:|--------:|:---:|------:|:------:|
 | `*-apple-ios` [1]                    | N/A    | N/A     | N/A | N/A   |   ✓    |
-| `aarch64-linux-android` [2]          | N/A    | 4.9     | ✓   | N/A   |   ✓    |
+| `aarch64-linux-android` [2]          | 9.0.0  | 4.9     | ✓   | 5.1.0 |   ✓    |
 | `aarch64-unknown-linux-gnu`          | 2.19   | 4.8.2   | ✓   | 5.1.0 |   ✓    |
 | `aarch64-unknown-linux-musl`         | 1.1.20 | 6.3.0   |     | 5.1.0 |   ✓    |
-| `arm-linux-androideabi` [2]          | N/A    | 4.9     | ✓   | N/A   |   ✓    |
+| `arm-linux-androideabi` [2]          | 9.0.0  | 4.9     | ✓   | 5.1.0 |   ✓    |
 | `arm-unknown-linux-gnueabi`          | 2.19   | 4.8.2   | ✓   | 5.1.0 |   ✓    |
 | `arm-unknown-linux-gnueabihf`        | 2.27   | 7.3.0   | ✓   | 5.1.0 |   ✓    |
 | `arm-unknown-linux-musleabi`         | 1.1.20 | 6.3.0   |     | 5.1.0 |   ✓    |
 | `arm-unknown-linux-musleabihf`       | 1.1.20 | 6.3.0   |     | 5.1.0 |   ✓    |
 | `armv5te-unknown-linux-gnueabi`      | 2.27   | 7.5.0   | ✓   | 5.1.0 |   ✓    |
 | `armv5te-unknown-linux-musleabi`     | 1.1.20 | 6.3.0   |     | 5.1.0 |   ✓    |
-| `armv7-linux-androideabi` [2]        | N/A    | 4.9     | ✓   | N/A   |   ✓    |
+| `armv7-linux-androideabi` [2]        | 9.0.0  | 4.9     | ✓   | 5.1.0 |   ✓    |
 | `armv7-unknown-linux-gnueabihf`      | 2.15   | 4.6.2   | ✓   | 5.1.0 |   ✓    |
 | `armv7-unknown-linux-musleabihf`     | 1.1.20 | 6.3.0   |     | 5.1.0 |   ✓    |
 | `i586-unknown-linux-gnu`             | 2.23   | 5.3.1   | ✓   | N/A   |   ✓    |
 | `i586-unknown-linux-musl`            | 1.1.20 | 6.3.0   |     | N/A   |   ✓    |
 | `i686-unknown-freebsd` [4]           | 12.1   | 6.4.0   |     | N/A   |   ✓    |
-| `i686-linux-android` [2]             | N/A    | 4.9     | ✓   | N/A   |   ✓    |
+| `i686-linux-android` [2]             | 9.0.0  | 4.9     | ✓   | 5.1.0 |   ✓    |
 | `i686-pc-windows-gnu`                | N/A    | 7.3.0   | ✓   | N/A   |   ✓    |
 | `i686-unknown-linux-gnu`             | 2.15   | 4.6.2   | ✓   | N/A   |   ✓    |
 | `i686-unknown-linux-musl`            | 1.1.20 | 6.3.0   |     | N/A   |   ✓    |
@@ -302,7 +302,7 @@ terminate.
 | `thumbv7em-none-eabihf` [5]          | 2.2.0  | 5.3.1   |     | N/A   |        |
 | `thumbv7m-none-eabi` [5]             | 2.2.0  | 5.3.1   |     | N/A   |        |
 | `wasm32-unknown-emscripten` [6]      | 1.1.15 | 1.37.13 | ✓   | N/A   |   ✓    |
-| `x86_64-linux-android` [2]           | N/A    | 4.9     | ✓   | N/A   |   ✓    |
+| `x86_64-linux-android` [2]           | 9.0.0  | 4.9     | ✓   | 5.1.0 |   ✓    |
 | `x86_64-pc-windows-gnu`              | N/A    | 7.3.0   | ✓   | N/A   |   ✓    |
 | `x86_64-sun-solaris` [4]             | 2.11   | 5.3.0   | ✓   | N/A   |        |
 | `x86_64-unknown-freebsd` [4]         | 12.1   | 6.4.0   |     | N/A   |   ✓    |
@@ -313,7 +313,7 @@ terminate.
 
 [1] iOS cross compilation is supported on macOS hosts.
 
-[2] Only works with native tests, that is, tests that do not depends on the
+[2] libc = bionic; Only works with native tests, that is, tests that do not depends on the
     Android Runtime. For i686 some tests may fails with the error `assertion
     failed: signal(libc::SIGPIPE, libc::SIG_IGN) != libc::SIG_ERR`, see
     [issue #140](https://github.com/cross-rs/cross/issues/140) for more
diff --git a/docs/cross_toml.md b/docs/cross_toml.md
index 662c541..32e0a39 100644
--- a/docs/cross_toml.md
+++ b/docs/cross_toml.md
@@ -25,17 +25,9 @@ The `target` key allows you to specify parameters for specific compilation targe
 
 ```toml
 [target.aarch64-unknown-linux-gnu]
+volumes = ["VOL1_ARG", "VOL2_ARG"]
+passthrough = ["VAR1", "VAR2"]
 xargo = false
 image = "test-image"
 runner = "custom-runner"
 ```
-
-# `target.TARGET.env`
-The `target` key allows you to specify environment variables that should be used for a specific compilation target.
-This is similar to `build.env`, but allows you to be more specific per target.
-
-```toml
-[target.x86_64-unknown-linux-gnu.env]
-volumes = ["VOL1_ARG", "VOL2_ARG"]
-passthrough = ["IMPORTANT_ENV_VARIABLES"]
-```
\ No newline at end of file
diff --git a/src/config.rs b/src/config.rs
index 17f810c..3ec2ab8 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -319,7 +319,7 @@ mod tests {
         use std::matches;
 
         fn toml(content: &str) -> Result<crate::CrossToml> {
-            Ok(CrossToml::parse(content).wrap_err("couldn't parse toml")?.0)
+            Ok(CrossToml::from_str(content).wrap_err("couldn't parse toml")?)
         }
 
         #[test]
diff --git a/src/cross_toml.rs b/src/cross_toml.rs
index fbddb93..f080157 100644
--- a/src/cross_toml.rs
+++ b/src/cross_toml.rs
@@ -3,11 +3,11 @@
 use crate::errors::*;
 use crate::{Target, TargetList};
 use serde::Deserialize;
-use std::collections::{BTreeSet, HashMap};
+use std::collections::HashMap;
 
-/// Environment configuration
-#[derive(Debug, Deserialize, PartialEq, Default)]
-pub struct CrossEnvConfig {
+/// Build environment configuration
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct CrossBuildEnvConfig {
     #[serde(default)]
     volumes: Vec<String>,
     #[serde(default)]
@@ -18,8 +18,7 @@ pub struct CrossEnvConfig {
 #[derive(Debug, Deserialize, PartialEq, Default)]
 #[serde(rename_all = "kebab-case")]
 pub struct CrossBuildConfig {
-    #[serde(default)]
-    env: CrossEnvConfig,
+    env: Option<CrossBuildEnvConfig>,
     xargo: Option<bool>,
     default_target: Option<String>,
 }
@@ -27,11 +26,13 @@ pub struct CrossBuildConfig {
 /// Target configuration
 #[derive(Debug, Deserialize, PartialEq)]
 pub struct CrossTargetConfig {
+    #[serde(default)]
+    passthrough: Vec<String>,
+    #[serde(default)]
+    volumes: Vec<String>,
     xargo: Option<bool>,
     image: Option<String>,
     runner: Option<String>,
-    #[serde(default)]
-    env: CrossEnvConfig,
 }
 
 /// Cross configuration
@@ -39,16 +40,15 @@ pub struct CrossTargetConfig {
 pub struct CrossToml {
     #[serde(default, rename = "target")]
     pub targets: HashMap<Target, CrossTargetConfig>,
-    #[serde(default)]
-    pub build: CrossBuildConfig,
+    pub build: Option<CrossBuildConfig>,
 }
 
 impl CrossToml {
     /// Parses the [`CrossToml`] from a string
-    pub fn parse(toml_str: &str) -> Result<(Self, BTreeSet<String>)> {
+    pub fn from_str(toml_str: &str) -> Result<Self> {
         let tomld = &mut toml::Deserializer::new(toml_str);
 
-        let mut unused = BTreeSet::new();
+        let mut unused = std::collections::BTreeSet::new();
 
         let cfg = serde_ignored::deserialize(tomld, |path| {
             unused.insert(path.to_string());
@@ -57,11 +57,11 @@ impl CrossToml {
         if !unused.is_empty() {
             eprintln!(
                 "Warning: found unused key(s) in Cross configuration:\n > {}",
-                unused.clone().into_iter().collect::<Vec<_>>().join(", ")
+                unused.into_iter().collect::<Vec<_>>().join(", ")
             );
         }
 
-        Ok((cfg, unused))
+        Ok(cfg)
     }
 
     /// Returns the `target.{}.image` part of `Cross.toml`
@@ -76,7 +76,7 @@ impl CrossToml {
 
     /// Returns the `build.xargo` or the `target.{}.xargo` part of `Cross.toml`
     pub fn xargo(&self, target: &Target) -> (Option<bool>, Option<bool>) {
-        let build_xargo = self.build.xargo;
+        let build_xargo = self.build.as_ref().and_then(|b| b.xargo);
         let target_xargo = self.get_target(target).and_then(|t| t.xargo);
 
         (build_xargo, target_xargo)
@@ -84,31 +84,33 @@ impl CrossToml {
 
     /// Returns the list of environment variables to pass through for `build`,
     pub fn env_passthrough_build(&self) -> Vec<String> {
-        self.build.env.passthrough.clone()
+        self.get_build_env()
+            .map_or(Vec::new(), |e| e.passthrough.clone())
     }
 
     /// Returns the list of environment variables to pass through for `target`,
     pub fn env_passthrough_target(&self, target: &Target) -> Vec<String> {
         self.get_target(target)
-            .map_or(Vec::new(), |t| t.env.passthrough.clone())
+            .map_or(Vec::new(), |t| t.passthrough.clone())
     }
 
     /// Returns the list of environment variables to pass through for `build`,
     pub fn env_volumes_build(&self) -> Vec<String> {
-        self.build.env.volumes.clone()
+        self.get_build_env()
+            .map_or(Vec::new(), |e| e.volumes.clone())
     }
 
     /// Returns the list of environment variables to pass through for `target`,
     pub fn env_volumes_target(&self, target: &Target) -> Vec<String> {
         self.get_target(target)
-            .map_or(Vec::new(), |t| t.env.volumes.clone())
+            .map_or(Vec::new(), |t| t.volumes.clone())
     }
 
     /// Returns the default target to build,
     pub fn default_target(&self, target_list: &TargetList) -> Option<Target> {
         self.build
-            .default_target
             .as_ref()
+            .and_then(|b| b.default_target.as_ref())
             .map(|t| Target::from(t, target_list))
     }
 
@@ -116,6 +118,11 @@ impl CrossToml {
     fn get_target(&self, target: &Target) -> Option<&CrossTargetConfig> {
         self.targets.get(target)
     }
+
+    /// Returns a reference to the [`CrossBuildEnvConfig`]
+    fn get_build_env(&self) -> Option<&CrossBuildEnvConfig> {
+        self.build.as_ref().and_then(|b| b.env.as_ref())
+    }
 }
 
 #[cfg(test)]
@@ -126,12 +133,11 @@ mod tests {
     pub fn parse_empty_toml() -> Result<()> {
         let cfg = CrossToml {
             targets: HashMap::new(),
-            build: CrossBuildConfig::default(),
+            build: None,
         };
-        let (parsed_cfg, unused) = CrossToml::parse("")?;
+        let parsed_cfg = CrossToml::from_str("")?;
 
         assert_eq!(parsed_cfg, cfg);
-        assert!(unused.is_empty());
 
         Ok(())
     }
@@ -140,14 +146,14 @@ mod tests {
     pub fn parse_build_toml() -> Result<()> {
         let cfg = CrossToml {
             targets: HashMap::new(),
-            build: CrossBuildConfig {
-                env: CrossEnvConfig {
+            build: Some(CrossBuildConfig {
+                env: Some(CrossBuildEnvConfig {
                     volumes: vec!["VOL1_ARG".to_string(), "VOL2_ARG".to_string()],
                     passthrough: vec!["VAR1".to_string(), "VAR2".to_string()],
-                },
+                }),
                 xargo: Some(true),
                 default_target: None,
-            },
+            }),
         };
 
         let test_str = r#"
@@ -158,10 +164,9 @@ mod tests {
           volumes = ["VOL1_ARG", "VOL2_ARG"]
           passthrough = ["VAR1", "VAR2"]
         "#;
-        let (parsed_cfg, unused) = CrossToml::parse(test_str)?;
+        let parsed_cfg = CrossToml::from_str(test_str)?;
 
         assert_eq!(parsed_cfg, cfg);
-        assert!(unused.is_empty());
 
         Ok(())
     }
@@ -174,10 +179,8 @@ mod tests {
                 triple: "aarch64-unknown-linux-gnu".to_string(),
             },
             CrossTargetConfig {
-                env: CrossEnvConfig {
-                    passthrough: vec!["VAR1".to_string(), "VAR2".to_string()],
-                    volumes: vec!["VOL1_ARG".to_string(), "VOL2_ARG".to_string()],
-                },
+                passthrough: vec!["VAR1".to_string(), "VAR2".to_string()],
+                volumes: vec!["VOL1_ARG".to_string(), "VOL2_ARG".to_string()],
                 xargo: Some(false),
                 image: Some("test-image".to_string()),
                 runner: None,
@@ -186,21 +189,19 @@ mod tests {
 
         let cfg = CrossToml {
             targets: target_map,
-            build: CrossBuildConfig::default(),
+            build: None,
         };
 
         let test_str = r#"
-            [target.aarch64-unknown-linux-gnu.env]
-            volumes = ["VOL1_ARG", "VOL2_ARG"]
-            passthrough = ["VAR1", "VAR2"]
-            [target.aarch64-unknown-linux-gnu]
-            xargo = false
-            image = "test-image"
+          [target.aarch64-unknown-linux-gnu]
+          volumes = ["VOL1_ARG", "VOL2_ARG"]
+          passthrough = ["VAR1", "VAR2"]
+          xargo = false
+          image = "test-image"
         "#;
-        let (parsed_cfg, unused) = CrossToml::parse(test_str)?;
+        let parsed_cfg = CrossToml::from_str(test_str)?;
 
         assert_eq!(parsed_cfg, cfg);
-        assert!(unused.is_empty());
 
         Ok(())
     }
diff --git a/src/main.rs b/src/main.rs
index 15df03a..79b6ca8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,8 +1,5 @@
 #![deny(missing_debug_implementations, rust_2018_idioms)]
 
-#[cfg(test)]
-mod tests;
-
 mod cargo;
 mod cli;
 mod config;
@@ -416,7 +413,7 @@ fn toml(root: &Root) -> Result<Option<CrossToml>> {
         let content = file::read(&path)
             .wrap_err_with(|| format!("could not read file `{}`", path.display()))?;
 
-        let (config, _) = CrossToml::parse(&content)
+        let config = CrossToml::from_str(&content)
             .wrap_err_with(|| format!("failed to parse file `{}` as TOML", path.display()))?;
 
         Ok(Some(config))


Test patch:
diff --git a/src/tests.rs b/src/tests.rs
deleted file mode 100644
index 5fa2991..0000000
--- a/src/tests.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-mod toml;
-
-use std::{
-    ffi::OsStr,
-    path::{Path, PathBuf},
-};
-
-use once_cell::sync::OnceCell;
-use serde::Deserialize;
-
-static WORKSPACE: OnceCell<PathBuf> = OnceCell::new();
-
-/// Returns the cargo workspace for the manifest
-pub fn get_cargo_workspace() -> &'static Path {
-    let manifest_dir = env!("CARGO_MANIFEST_DIR");
-    WORKSPACE.get_or_init(|| {
-        #[derive(Deserialize)]
-        struct Manifest {
-            workspace_root: PathBuf,
-        }
-        let output = std::process::Command::new(
-            std::env::var("CARGO")
-                .ok()
-                .unwrap_or_else(|| "cargo".to_string()),
-        )
-        .arg("metadata")
-        .arg("--format-version=1")
-        .arg("--no-deps")
-        .current_dir(manifest_dir)
-        .output()
-        .unwrap();
-        let manifest: Manifest = serde_json::from_slice(&output.stdout).unwrap();
-        manifest.workspace_root
-    })
-}
-
-pub fn walk_dir<'a>(
-    root: &'_ Path,
-    skip: &'a [impl AsRef<OsStr>],
-) -> impl Iterator<Item = Result<walkdir::DirEntry, walkdir::Error>> + 'a {
-    walkdir::WalkDir::new(root).into_iter().filter_entry(|e| {
-        if skip
-            .iter()
-            .map(|s| -> &std::ffi::OsStr { s.as_ref() })
-            .any(|dir| e.file_name() == dir)
-        {
-            return false;
-        } else if e.file_type().is_dir() {
-            return true;
-        }
-        e.path().extension() == Some("md".as_ref())
-    })
-}
diff --git a/src/tests/toml.rs b/src/tests/toml.rs
deleted file mode 100644
index e39389e..0000000
--- a/src/tests/toml.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-use std::io::Read;
-
-use once_cell::sync::Lazy;
-use regex::{Regex, RegexBuilder};
-
-static TOML_REGEX: Lazy<Regex> = Lazy::new(|| {
-    RegexBuilder::new(r#"```toml\n(.*?)```"#)
-        .multi_line(true)
-        .dot_matches_new_line(true)
-        .build()
-        .unwrap()
-});
-
-#[test]
-fn toml_check() -> Result<(), Box<dyn std::error::Error>> {
-    let workspace_root = super::get_cargo_workspace();
-    let walk = super::walk_dir(
-        workspace_root,
-        &[
-            "target",
-            ".git",
-            "src",
-            "CODE_OF_CONDUCT.md",
-            "CHANGELOG.md",
-        ],
-    );
-
-    for dir_entry in walk {
-        let dir_entry = dir_entry?;
-        if dir_entry.file_type().is_dir() {
-            continue;
-        }
-        eprintln!("File: {:?}", dir_entry.path().display());
-        let mut file = std::fs::File::open(dir_entry.path()).unwrap();
-        let mut contents = String::new();
-        file.read_to_string(&mut contents).unwrap();
-        for matches in TOML_REGEX.captures_iter(&contents) {
-            let fence = matches.get(1).unwrap();
-            eprintln!(
-                "testing snippet at: {}:{:?}",
-                dir_entry.path().display(),
-                text_line_no(&contents, fence.range().start),
-            );
-            assert!(crate::cross_toml::CrossToml::parse(fence.as_str())?
-                .1
-                .is_empty());
-        }
-    }
-    Ok(())
-}
-
-pub fn text_line_no(text: &str, index: usize) -> usize {
-    let mut line_no = 0;
-    let mut count = 0;
-    for line in text.split('\n') {
-        line_no += 1;
-        count += line.as_bytes().len() + 1;
-        if count >= index {
-            break;
-        }
-    }
-    line_no
-}