Skip to content

Commit

Permalink
bless tidy and remove unused function
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Oct 7, 2023
1 parent e1a9ba9 commit 4166849
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 38 deletions.
4 changes: 3 additions & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ use crate::core::builder::Cargo;
use crate::core::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath};
use crate::core::config::{DebuginfoLevel, LlvmLibunwind, RustcLto, TargetSelection};
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::helpers::{exe, is_debug_info, get_clang_cl_resource_dir, is_dylib, output, symlink_dir, t, up_to_date};
use crate::utils::helpers::{
exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, output, symlink_dir, t, up_to_date,
};
use crate::LLVM_TOOLS;
use crate::{CLang, Compiler, DependencyType, GitRepo, Mode};
use filetime::FileTime;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection;
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::channel;
use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
use crate::utils::helpers::{exe, is_dylib, output, t, timeit};
use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS};

pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use std::process::Command;
use crate::core::build_steps::dist;
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::core::config::{Config, TargetSelection};
use crate::utils::tarball::GeneratedTarball;
use crate::utils::helpers::t;
use crate::utils::tarball::GeneratedTarball;
use crate::{Compiler, Kind};

#[cfg(target_os = "illumos")]
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::process::Command;
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::core::config::{Config, TargetSelection};
use crate::utils::channel;
use crate::utils::helpers::{self, exe, output, t, up_to_date, get_clang_cl_resource_dir};
use crate::utils::helpers::{self, exe, get_clang_cl_resource_dir, output, t, up_to_date};
use crate::{CLang, GitRepo, Kind};

use build_helper::ci::CiEnv;
Expand Down
13 changes: 9 additions & 4 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ use crate::core::config::flags::Subcommand;
use crate::core::config::TargetSelection;
use crate::utils;
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::render_tests::{try_run_tests, add_flags_and_try_run_tests};
use crate::utils::helpers::{self, add_link_lib_path, dylib_path, dylib_path_var, output, t, up_to_date};
use crate::utils::helpers::{
self, add_link_lib_path, dylib_path, dylib_path_var, output, t, up_to_date,
};
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
use crate::{envify, CLang, DocTests, GitRepo, Mode};

const ADB_TEST_DIR: &str = "/data/local/tmp/work";
Expand Down Expand Up @@ -905,7 +907,8 @@ impl Step for RustdocJSStd {
.arg("--test-folder")
.arg(builder.src.join("tests/rustdoc-js-std"));
for path in &builder.paths {
if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder) {
if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder)
{
if !p.ends_with(".js") {
eprintln!("A non-js file was given: `{}`", path.display());
panic!("Cannot run rustdoc-js-std tests");
Expand Down Expand Up @@ -2680,7 +2683,9 @@ impl Step for Distcheck {
.current_dir(&dir),
);
builder.run(
Command::new(helpers::make(&builder.config.build.triple)).arg("check").current_dir(&dir),
Command::new(helpers::make(&builder.config.build.triple))
.arg("check")
.current_dir(&dir),
);

// Now make sure that rust-src has all of libstd's dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use std::str::FromStr;
use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
use crate::core::config::flags::{Color, Flags, Warnings};
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::channel::{self, GitInfo};
use crate::utils::cc_detect::{ndk_compiler, Language};
use crate::utils::channel::{self, GitInfo};
use crate::utils::helpers::{exe, output, t};
use build_helper::exit;
use once_cell::sync::OnceCell;
Expand Down
5 changes: 1 addition & 4 deletions src/bootstrap/src/core/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use xz2::bufread::XzDecoder;
use crate::core::build_steps::llvm::detect_llvm_sha;
use crate::core::config::RustfmtMetadata;
use crate::utils::helpers::{check_run, exe, program_out_of_date};
use crate::{
t,
Config,
};
use crate::{t, Config};

static SHOULD_FIX_BINS_AND_DYLIBS: OnceCell<bool> = OnceCell::new();

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ use std::str;
use build_helper::ci::{gha, CiEnv};
use build_helper::exit;
use filetime::FileTime;
use utils::channel::GitInfo;
use once_cell::sync::OnceCell;
use termcolor::{ColorChoice, StandardStream, WriteColor};
use utils::channel::GitInfo;

use crate::core::builder;
use crate::core::builder::Kind;
Expand All @@ -40,8 +40,8 @@ use crate::core::config::{DryRun, Target};
use crate::core::config::{LlvmLibunwind, TargetSelection};
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::helpers::{
self,
dir_is_empty, exe, libdir, mtime, output, run, run_suppressed, symlink_dir, try_run_suppressed,
self, dir_is_empty, exe, libdir, mtime, output, run, run_suppressed, symlink_dir,
try_run_suppressed,
};

mod core;
Expand Down
17 changes: 0 additions & 17 deletions src/bootstrap/src/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,23 +293,6 @@ pub fn output(cmd: &mut Command) -> String {
String::from_utf8(output.stdout).unwrap()
}

pub fn output_result(cmd: &mut Command) -> Result<String, String> {
let output = match cmd.stderr(Stdio::inherit()).output() {
Ok(status) => status,
Err(e) => return Err(format!("failed to run command: {cmd:?}: {e}")),
};
if !output.status.success() {
return Err(format!(
"command did not execute successfully: {:?}\n\
expected success, got: {}\n{}",
cmd,
output.status,
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
));
}
Ok(String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))?)
}

/// Returns the last-modified time for `path`, or zero if it doesn't exist.
pub fn mtime(path: &Path) -> SystemTime {
fs::metadata(path).and_then(|f| f.modified()).unwrap_or(UNIX_EPOCH)
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
//! channels, job management, etc.

pub(crate) mod cache;
pub(crate) mod channel;
pub(crate) mod job;
pub(crate) mod render_tests;
pub(crate) mod tarball;
pub(crate) mod cc_detect;
pub(crate) mod channel;
pub(crate) mod helpers;
pub(crate) mod job;
#[cfg(feature = "build-metrics")]
pub(crate) mod metrics;
pub(crate) mod render_tests;
pub(crate) mod tarball;
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/tarball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::{

use crate::core::build_steps::dist::distdir;
use crate::core::builder::Builder;
use crate::utils::helpers::t;
use crate::utils::channel;
use crate::utils::helpers::t;

#[derive(Copy, Clone)]
pub(crate) enum OverlayKind {
Expand Down

0 comments on commit 4166849

Please sign in to comment.