Skip to content

Commit f1f3470

Browse files
authored
Rollup merge of rust-lang#59309 - o01eg:verbose-copy-files, r=alexcrichton
Add messages for different verbosity levels. Output copy actions.
2 parents 8a36f76 + b6e5d73 commit f1f3470

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bootstrap/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,17 @@ impl Build {
726726
}
727727
}
728728

729+
pub fn is_verbose_than(&self, level: usize) -> bool {
730+
self.verbosity > level
731+
}
732+
733+
/// Prints a message if this build is configured in more verbose mode than `level`.
734+
fn verbose_than(&self, level: usize, msg: &str) {
735+
if self.is_verbose_than(level) {
736+
println!("{}", msg);
737+
}
738+
}
739+
729740
fn info(&self, msg: &str) {
730741
if self.config.dry_run { return; }
731742
println!("{}", msg);
@@ -1158,6 +1169,7 @@ impl Build {
11581169
/// Copies a file from `src` to `dst`
11591170
pub fn copy(&self, src: &Path, dst: &Path) {
11601171
if self.config.dry_run { return; }
1172+
self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst));
11611173
let _ = fs::remove_file(&dst);
11621174
let metadata = t!(src.symlink_metadata());
11631175
if metadata.file_type().is_symlink() {

0 commit comments

Comments
 (0)