Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Commit 99303dd

Browse files
bors[bot]Disasm
andauthored
Merge #100
100: Simplify build.rs example r=dkhayes117 a=Disasm Co-authored-by: Vadim Kaushan <[email protected]>
2 parents 0ff428f + 65d674c commit 99303dd

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/lib.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,17 @@
8181
//!
8282
//! ``` ignore,no_run
8383
//! use std::env;
84-
//! use std::fs::File;
85-
//! use std::io::Write;
86-
//! use std::path::Path;
84+
//! use std::fs;
85+
//! use std::path::PathBuf;
8786
//!
88-
//! /// Put the linker script somewhere the linker can find it.
8987
//! fn main() {
90-
//! let out_dir = env::var("OUT_DIR").expect("No out dir");
91-
//! let dest_path = Path::new(&out_dir);
92-
//! let mut f = File::create(&dest_path.join("memory.x"))
93-
//! .expect("Could not create file");
94-
//!
95-
//! f.write_all(include_bytes!("memory.x"))
96-
//! .expect("Could not write file");
97-
//!
98-
//! println!("cargo:rustc-link-search={}", dest_path.display());
88+
//! let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
9989
//!
90+
//! // Put the linker script somewhere the linker can find it.
91+
//! fs::write(out_dir.join("memory.x"), include_bytes!("memory.x")).unwrap();
92+
//! println!("cargo:rustc-link-search={}", out_dir.display());
10093
//! println!("cargo:rerun-if-changed=memory.x");
94+
//!
10195
//! println!("cargo:rerun-if-changed=build.rs");
10296
//! }
10397
//! ```

0 commit comments

Comments
 (0)