Skip to content

Commit

Permalink
Removing unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Dec 7, 2023
1 parent 565e725 commit d00ee50
Show file tree
Hide file tree
Showing 19 changed files with 123 additions and 349 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ turborepo-api-client = { path = "crates/turborepo-api-client" }
turborepo-cache = { path = "crates/turborepo-cache" }
turborepo-ci = { path = "crates/turborepo-ci" }
turborepo-env = { path = "crates/turborepo-env" }
turborepo-errors = { path = "crates/turborepo-errors" }
turborepo-ffi = { path = "crates/turborepo-ffi" }
turborepo-fs = { path = "crates/turborepo-fs" }
turborepo-lib = { path = "crates/turborepo-lib", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-cache/src/cache_archive/restore_symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn actually_restore_symlink<'a>(
let link_name = header.link_name()?.expect("have linkname");
let symlink_to = link_name.to_str().ok_or_else(|| {
CacheError::PathError(
PathError::InvalidUnicode(link_name.to_string_lossy().to_string(), None),
PathError::InvalidUnicode(link_name.to_string_lossy().to_string()),
Backtrace::capture(),
)
})?;
Expand Down Expand Up @@ -93,7 +93,7 @@ pub fn canonicalize_linkname(
) -> Result<AbsoluteSystemPathBuf, CacheError> {
let linkname = linkname.try_into().map_err(|_| {
CacheError::PathError(
PathError::InvalidUnicode(linkname.to_string_lossy().to_string(), None),
PathError::InvalidUnicode(linkname.to_string_lossy().to_string()),
Backtrace::capture(),
)
})?;
Expand All @@ -119,7 +119,7 @@ pub fn canonicalize_linkname(
// In order to DAG sort them, however, we do need to canonicalize them.
// We canonicalize them as if we're restoring them verbatim.
//
match turbopath::categorize(linkname, None) {
match turbopath::categorize(linkname) {
// 1. Check to see if the link target is absolute _on the current platform_.
// If it is an absolute path it's canonical by rule.
UnknownPathType::Absolute(abs) => Ok(abs),
Expand Down
11 changes: 0 additions & 11 deletions crates/turborepo-errors/Cargo.toml

This file was deleted.

82 changes: 0 additions & 82 deletions crates/turborepo-errors/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/turborepo-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ turborepo-api-client = { workspace = true }
turborepo-cache = { workspace = true }
turborepo-ci = { workspace = true }
turborepo-env = { workspace = true }
turborepo-errors = { workspace = true }
turborepo-filewatch = { path = "../turborepo-filewatch" }
turborepo-lockfiles = { workspace = true }
turborepo-scm = { workspace = true }
Expand Down
21 changes: 1 addition & 20 deletions crates/turborepo-lib/src/cli/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{backtrace, sync::Arc};
use std::backtrace;

use thiserror::Error;
use turborepo_errors::{Provenance, Sourced};
use turborepo_repository::package_graph;

use crate::{
Expand Down Expand Up @@ -46,21 +45,3 @@ pub enum Error {
#[error(transparent)]
SerdeJson(#[from] serde_json::Error),
}

impl Sourced for Error {
fn with_provenance(self, provenance: Option<Arc<Provenance>>) -> Self {
match self {
Self::Path(e) => Self::Path(e.with_provenance(provenance)),
Self::Run(e) => Self::Run(e.with_provenance(provenance)),
_ => todo!(),
}
}

fn provenance(&self) -> Option<Arc<Provenance>> {
match self {
Self::Path(e) => e.provenance(),
Self::Run(e) => e.provenance(),
_ => todo!(),
}
}
}
4 changes: 1 addition & 3 deletions crates/turborepo-lib/src/commands/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use tracing::trace;
use turbopath::{
AbsoluteSystemPathBuf, AnchoredSystemPath, AnchoredSystemPathBuf, RelativeUnixPath,
};
use turborepo_errors::{Provenance, Sourced};
use turborepo_repository::{
package_graph::{self, PackageGraph, WorkspaceName, WorkspaceNode},
package_json::PackageJson,
Expand Down Expand Up @@ -261,8 +260,7 @@ impl<'a> Prune<'a> {
.build()
.await?;

let out_directory = AbsoluteSystemPathBuf::from_unknown(&base.repo_root, output_dir)
.with_provenance(Provenance::from_flag("out-dir"));
let out_directory = AbsoluteSystemPathBuf::from_unknown(&base.repo_root, output_dir);

let full_directory = match docker {
true => out_directory.join_component("full"),
Expand Down
19 changes: 0 additions & 19 deletions crates/turborepo-lib/src/run/error.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::sync::Arc;

use miette::Diagnostic;
use thiserror::Error;
use turborepo_errors::{Provenance, Sourced};
use turborepo_repository::package_graph;

use super::graph_visualizer;
Expand Down Expand Up @@ -52,19 +49,3 @@ pub enum Error {
#[error("error registering signal handler: {0}")]
SignalHandler(std::io::Error),
}

impl Sourced for Error {
fn with_provenance(self, provenance: Option<Arc<Provenance>>) -> Self {
match self {
Self::Path(e) => Self::Path(e.with_provenance(provenance)),
_ => todo!(),
}
}

fn provenance(&self) -> Option<Arc<Provenance>> {
match self {
Self::Path(e) => e.provenance().clone(),
_ => None,
}
}
}
4 changes: 1 addition & 3 deletions crates/turborepo-lib/src/run/graph_visualizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{

use thiserror::Error;
use turbopath::{AbsoluteSystemPath, AbsoluteSystemPathBuf};
use turborepo_errors::{Provenance, Sourced};
use turborepo_ui::{cprintln, cwrite, cwriteln, BOLD, BOLD_YELLOW_REVERSE, UI, YELLOW};
use which::which;

Expand Down Expand Up @@ -142,8 +141,7 @@ fn filename_and_extension(
cwd: &AbsoluteSystemPath,
raw_filename: &str,
) -> Result<(AbsoluteSystemPathBuf, String), Error> {
let graph_file = AbsoluteSystemPathBuf::from_unknown(cwd, raw_filename)
.with_provenance(Provenance::from_flag("graph"));
let graph_file = AbsoluteSystemPathBuf::from_unknown(cwd, raw_filename);
if let Some(extension) = graph_file.extension() {
let extension = extension.to_string();
Ok((graph_file, extension))
Expand Down
Loading

0 comments on commit d00ee50

Please sign in to comment.