use std::{fs, path::Path}; fn main() { let sub_crate = Path::new("sub-crate"); publish_assertion(sub_crate); create_sub_manifest(sub_crate); } fn publish_assertion(sub_crate: &Path) { let sub_crate = sub_crate.join("src"); if !sub_crate.exists() { panic!("Could not find `sub-crate`. Help: There must be no sub-crate/Cargo.toml when publishing"); } } fn create_sub_manifest(sub_crate: &Path) { fs::copy(sub_crate.join("sub-Cargo.toml"), sub_crate.join("Cargo.toml")).unwrap(); }