Skip to content

Commit 7b17faf

Browse files
JakobDegenmeta-codesync[bot]
authored andcommitted
Delete dead cells code
Summary: Missed it in D87300266 Reviewed By: get9 Differential Revision: D87717943 fbshipit-source-id: ebbf1affc958c2f77fd1fcc9396364315b80897b
1 parent 8c2a554 commit 7b17faf

File tree

2 files changed

+0
-122
lines changed

2 files changed

+0
-122
lines changed

app/buck2_core/src/cells.rs

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ use std::fmt::Debug;
9595
use std::sync::Arc;
9696

9797
use allocative::Allocative;
98-
use buck2_error::BuckErrorContext;
9998
use buck2_fs::paths::abs_path::AbsPath;
10099
use buck2_fs::paths::file_name::FileNameBuf;
101100
use dupe::Dupe;
@@ -457,27 +456,6 @@ impl CellResolver {
457456

458457
CellResolver::new(instances, root_aliases).unwrap()
459458
}
460-
461-
pub(crate) fn resolve_path_crossing_cell_boundaries<'a>(
462-
&self,
463-
mut path: CellPathRef<'a>,
464-
) -> buck2_error::Result<CellPathRef<'a>> {
465-
let mut rem: u32 = 1000;
466-
loop {
467-
// Sanity check. Should never happen.
468-
rem = rem
469-
.checked_sub(1)
470-
.buck_error_context("Overflow computing cell boundaries")?;
471-
472-
let nested_cells = self.get(path.cell())?.nested_cells();
473-
match nested_cells.matches_checked(path.path()) {
474-
None => return Ok(path),
475-
Some((_, new_cell_path)) => {
476-
path = new_cell_path;
477-
}
478-
}
479-
}
480-
}
481459
}
482460

483461
#[cfg(test)]
@@ -570,90 +548,4 @@ mod tests {
570548

571549
Ok(())
572550
}
573-
574-
#[test]
575-
fn test_resolve_path_crossing_cell_boundaries() {
576-
let cell_resolver = CellResolver::testing_with_names_and_paths(&[
577-
(
578-
CellName::testing_new("fbsource"),
579-
CellRootPathBuf::testing_new(""),
580-
),
581-
(
582-
CellName::testing_new("fbcode"),
583-
CellRootPathBuf::testing_new("fbcode"),
584-
),
585-
(
586-
CellName::testing_new("fbcode_macros"),
587-
CellRootPathBuf::testing_new("fbcode/something/macros"),
588-
),
589-
]);
590-
// Test starting with `fbsource//`.
591-
assert_eq!(
592-
CellPathRef::testing_new("fbsource//"),
593-
cell_resolver
594-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new("fbsource//"))
595-
.unwrap()
596-
);
597-
assert_eq!(
598-
CellPathRef::testing_new("fbcode//"),
599-
cell_resolver
600-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new("fbsource//fbcode"))
601-
.unwrap()
602-
);
603-
assert_eq!(
604-
CellPathRef::testing_new("fbcode//something"),
605-
cell_resolver
606-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new(
607-
"fbsource//fbcode/something"
608-
))
609-
.unwrap()
610-
);
611-
assert_eq!(
612-
CellPathRef::testing_new("fbcode_macros//"),
613-
cell_resolver
614-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new(
615-
"fbsource//fbcode/something/macros"
616-
))
617-
.unwrap()
618-
);
619-
assert_eq!(
620-
CellPathRef::testing_new("fbcode_macros//xx"),
621-
cell_resolver
622-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new(
623-
"fbsource//fbcode/something/macros/xx"
624-
))
625-
.unwrap()
626-
);
627-
// Now test starting with `fbcode//`.
628-
assert_eq!(
629-
CellPathRef::testing_new("fbcode//"),
630-
cell_resolver
631-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new("fbcode//"))
632-
.unwrap()
633-
);
634-
assert_eq!(
635-
CellPathRef::testing_new("fbcode//something"),
636-
cell_resolver
637-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new(
638-
"fbcode//something"
639-
))
640-
.unwrap()
641-
);
642-
assert_eq!(
643-
CellPathRef::testing_new("fbcode_macros//"),
644-
cell_resolver
645-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new(
646-
"fbcode//something/macros"
647-
))
648-
.unwrap()
649-
);
650-
assert_eq!(
651-
CellPathRef::testing_new("fbcode_macros//xx"),
652-
cell_resolver
653-
.resolve_path_crossing_cell_boundaries(CellPathRef::testing_new(
654-
"fbcode//something/macros/xx"
655-
))
656-
.unwrap()
657-
);
658-
}
659551
}

app/buck2_core/src/cells/nested.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use allocative::Allocative;
1212

13-
use crate::cells::cell_path::CellPathRef;
1413
use crate::cells::cell_root_path::CellRootPath;
1514
use crate::cells::name::CellName;
1615
use crate::cells::paths::CellRelativePath;
@@ -84,19 +83,6 @@ impl NestedCells {
8483
None
8584
}
8685

87-
pub(crate) fn matches_checked<'a, 'b>(
88-
&'a self,
89-
path: &'b CellRelativePath,
90-
) -> Option<(&'a CellRelativePath, CellPathRef<'b>)> {
91-
self.matches(UncheckedCellRelativePath::new(path))
92-
.map(|(cell_path, cell_name, rem)| {
93-
(
94-
cell_path,
95-
CellPathRef::new(cell_name, CellRelativePath::unchecked_new(rem.as_str())),
96-
)
97-
})
98-
}
99-
10086
pub(crate) fn check_empty(&self) -> Option<CellName> {
10187
self.paths.first().map(|(_, cell_name)| *cell_name)
10288
}

0 commit comments

Comments
 (0)