1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! These modules expose the internal workings of `cargo-geiger`. They
//! are currently not stable, and therefore have no associated `SemVer`.
//! As such, any function contained within may be subject to change.

#![deny(clippy::cargo)]
#![deny(clippy::doc_markdown)]
#![forbid(unsafe_code)]
#![deny(warnings)]

/// Argument parsing
pub mod args;
/// Bootstrapping functions for structs required by the CLI
pub mod cli;
/// Construction of the dependency graph
pub mod graph;
/// Mapping functionality from `cargo::core` to `cargo_metadata`
pub mod mapping;
/// Interaction with README.md files
pub mod readme;
/// Functions for scanning projects for unsafe code
pub mod scan;

/// Inner display formatting
mod format;
/// Tree construction
mod tree;

#[cfg(test)]
mod lib_tests {
    use cargo_metadata::{CargoOpt, Metadata, MetadataCommand};
    use krates::Builder as KratesBuilder;
    use krates::Krates;

    pub fn construct_krates_and_metadata() -> (Krates, Metadata) {
        let metadata = MetadataCommand::new()
            .manifest_path("./Cargo.toml")
            .features(CargoOpt::AllFeatures)
            .exec()
            .unwrap();

        let krates = KratesBuilder::new()
            .build_with_metadata(metadata.clone(), |_| ())
            .unwrap();

        (krates, metadata)
    }
}