From b38992c63d2f92b2874619c6683b32ecdc59b333 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 13 Mar 2017 02:12:13 +0200 Subject: [PATCH] some style fixes --- src/librustc/cfg/construct.rs | 32 ++++++----- src/librustc/dep_graph/dep_tracking_map.rs | 2 +- src/librustc/dep_graph/visit.rs | 9 ++-- src/librustc/lint/context.rs | 14 +++-- src/librustc/session/code_stats.rs | 5 +- src/librustc/traits/specialize/mod.rs | 4 +- src/librustc/ty/error.rs | 2 +- src/librustc/ty/item_path.rs | 3 +- src/librustc/ty/maps.rs | 2 +- src/librustc/ty/sty.rs | 62 +++++++++++----------- src/librustc/ty/util.rs | 30 +++++------ src/librustc/util/common.rs | 7 +-- src/librustc/util/fs.rs | 2 +- 13 files changed, 91 insertions(+), 83 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 4567795184e4d..7a70eda955b69 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -52,14 +52,16 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: tables, graph: graph, fn_exit: fn_exit, - loop_scopes: Vec::new() + loop_scopes: Vec::new(), }; body_exit = cfg_builder.expr(&body.value, entry); cfg_builder.add_contained_edge(body_exit, fn_exit); - let CFGBuilder {graph, ..} = cfg_builder; - CFG {graph: graph, - entry: entry, - exit: fn_exit} + let CFGBuilder { graph, .. } = cfg_builder; + CFG { + graph: graph, + entry: entry, + exit: fn_exit, + } } impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { @@ -81,7 +83,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { self.add_ast_node(id, &[exit]) } - hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => { + hir::StmtExpr(ref expr, id) | + hir::StmtSemi(ref expr, id) => { let exit = self.expr(&expr, pred); self.add_ast_node(id, &[exit]) } @@ -95,9 +98,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { self.pat(&local.pat, init_exit) } - hir::DeclItem(_) => { - pred - } + hir::DeclItem(_) => pred, } } @@ -107,9 +108,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { PatKind::Path(_) | PatKind::Lit(..) | PatKind::Range(..) | - PatKind::Wild => { - self.add_ast_node(pat.id, &[pred]) - } + PatKind::Wild => self.add_ast_node(pat.id, &[pred]), PatKind::Box(ref subpat) | PatKind::Ref(ref subpat, _) | @@ -125,8 +124,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } PatKind::Struct(_, ref subpats, _) => { - let pats_exit = - self.pats_all(subpats.iter().map(|f| &f.node.pat), pred); + let pats_exit = self.pats_all(subpats.iter().map(|f| &f.node.pat), pred); self.add_ast_node(pat.id, &[pats_exit]) } @@ -385,7 +383,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { let method_call = ty::MethodCall::expr(call_expr.id); let fn_ty = match self.tables.method_map.get(&method_call) { Some(method) => method.ty, - None => self.tables.expr_ty_adjusted(func_or_rcvr) + None => self.tables.expr_ty_adjusted(func_or_rcvr), }; let func_or_rcvr_exit = self.expr(func_or_rcvr, pred); @@ -556,7 +554,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { from_index: CFGIndex, to_loop: LoopScope, to_index: CFGIndex) { - let mut data = CFGEdgeData {exiting_scopes: vec![] }; + let mut data = CFGEdgeData { exiting_scopes: vec![] }; let mut scope = self.tcx.region_maps.node_extent(from_expr.id); let target_scope = self.tcx.region_maps.node_extent(to_loop.loop_id); while scope != target_scope { @@ -591,7 +589,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } span_bug!(expr.span, "no loop scope for id {}", loop_id); } - Err(err) => span_bug!(expr.span, "loop scope error: {}", err) + Err(err) => span_bug!(expr.span, "loop scope error: {}", err), } } } diff --git a/src/librustc/dep_graph/dep_tracking_map.rs b/src/librustc/dep_graph/dep_tracking_map.rs index 9f45e66f0d937..0f3108df9a822 100644 --- a/src/librustc/dep_graph/dep_tracking_map.rs +++ b/src/librustc/dep_graph/dep_tracking_map.rs @@ -39,7 +39,7 @@ impl DepTrackingMap { DepTrackingMap { phantom: PhantomData, graph: graph, - map: FxHashMap() + map: FxHashMap(), } } diff --git a/src/librustc/dep_graph/visit.rs b/src/librustc/dep_graph/visit.rs index a34a3591c151d..93f6e3a83a0c2 100644 --- a/src/librustc/dep_graph/visit.rs +++ b/src/librustc/dep_graph/visit.rs @@ -29,7 +29,7 @@ pub fn visit_all_item_likes_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx, 'tcx> struct TrackingVisitor<'visit, 'tcx: 'visit, F: 'visit, V: 'visit> { tcx: TyCtxt<'visit, 'tcx, 'tcx>, dep_node_fn: &'visit mut F, - visitor: &'visit mut V + visitor: &'visit mut V, } impl<'visit, 'tcx, F, V> ItemLikeVisitor<'tcx> for TrackingVisitor<'visit, 'tcx, F, V> @@ -70,13 +70,16 @@ pub fn visit_all_item_likes_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx, 'tcx> let mut tracking_visitor = TrackingVisitor { tcx: tcx, dep_node_fn: &mut dep_node_fn, - visitor: visitor + visitor: visitor, }; krate.visit_all_item_likes(&mut tracking_visitor) } pub fn visit_all_bodies_in_krate<'a, 'tcx, C>(tcx: TyCtxt<'a, 'tcx, 'tcx>, callback: C) - where C: Fn(/* body_owner */ DefId, /* body id */ hir::BodyId), + where C: Fn(/* body_owner */ + DefId, + /* body id */ + hir::BodyId) { let krate = tcx.hir.krate(); for &body_id in &krate.body_ids { diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 9279f24a57ab3..708a74c791af7 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -113,13 +113,19 @@ impl<'a, S: Into> IntoEarlyLint for (S, &'a str) { let (span, msg) = self; let mut diagnostic = Diagnostic::new(errors::Level::Warning, msg); diagnostic.set_span(span); - EarlyLint { id: id, diagnostic: diagnostic } + EarlyLint { + id: id, + diagnostic: diagnostic, + } } } impl IntoEarlyLint for Diagnostic { fn into_early_lint(self, id: LintId) -> EarlyLint { - EarlyLint { id: id, diagnostic: self } + EarlyLint { + id: id, + diagnostic: self, + } } } @@ -146,7 +152,7 @@ enum TargetLint { enum FindLintError { NotFound, - Removed + Removed, } impl LintStore { @@ -1127,7 +1133,7 @@ enum CheckLintNameResult { NoLint, // The lint is either renamed or removed. This is the warning // message. - Warning(String) + Warning(String), } /// Checks the name of a lint for its existence, and whether it was diff --git a/src/librustc/session/code_stats.rs b/src/librustc/session/code_stats.rs index a042b2abf3a29..215539de6766e 100644 --- a/src/librustc/session/code_stats.rs +++ b/src/librustc/session/code_stats.rs @@ -25,7 +25,10 @@ pub struct VariantInfo { } #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] -pub enum SizeKind { Exact, Min } +pub enum SizeKind { + Exact, + Min, +} #[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct FieldInfo { diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 79df7de04f540..2c99ee21b0f73 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -37,7 +37,7 @@ pub mod specialization_graph; pub struct OverlapError { pub with_impl: DefId, pub trait_desc: String, - pub self_desc: Option + pub self_desc: Option, } /// Given a subst for the requested impl, translate it to a subst @@ -274,7 +274,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } pub struct SpecializesCache { - map: FxHashMap<(DefId, DefId), bool> + map: FxHashMap<(DefId, DefId), bool>, } impl SpecializesCache { diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 44a3aabc0560a..5a696446b4bb6 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -23,7 +23,7 @@ use hir; #[derive(Clone, Copy, Debug)] pub struct ExpectedFound { pub expected: T, - pub found: T + pub found: T, } // Data structures used in type unification diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index 448be7fe9a149..874e032bc4644 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -374,14 +374,13 @@ impl LocalPathBuffer { fn new(root_mode: RootMode) -> LocalPathBuffer { LocalPathBuffer { root_mode: root_mode, - str: String::new() + str: String::new(), } } fn into_string(self) -> String { self.str } - } impl ItemPathBuffer for LocalPathBuffer { diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs index fcfdda8721f52..af05c0c43113b 100644 --- a/src/librustc/ty/maps.rs +++ b/src/librustc/ty/maps.rs @@ -85,7 +85,7 @@ impl<'tcx> Value<'tcx> for Ty<'tcx> { pub struct CycleError<'a> { span: Span, - cycle: RefMut<'a, [(Span, Query)]> + cycle: RefMut<'a, [(Span, Query)]>, } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index e686d62019145..0e3005847bc2c 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -45,7 +45,7 @@ pub struct TypeAndMut<'tcx> { /// at least as big as the scope `fr.scope`". pub struct FreeRegion { pub scope: region::CodeExtent, - pub bound_region: BoundRegion + pub bound_region: BoundRegion, } #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, @@ -65,7 +65,7 @@ pub enum BoundRegion { // Anonymous region for the implicit env pointer parameter // to a closure - BrEnv + BrEnv, } /// When a region changed from late-bound to early-bound when #32330 @@ -320,7 +320,7 @@ impl<'tcx> Slice> { pub fn principal(&self) -> Option> { match self.get(0) { Some(&ExistentialPredicate::Trait(tr)) => Some(tr), - _ => None + _ => None, } } @@ -520,13 +520,13 @@ impl Binder { ty::Binder(&self.0) } - pub fn map_bound_ref(&self, f: F) -> Binder + pub fn map_bound_ref(&self, f: F) -> Binder where F: FnOnce(&T) -> U { self.as_ref().map_bound(f) } - pub fn map_bound(self, f: F) -> Binder + pub fn map_bound(self, f: F) -> Binder where F: FnOnce(T) -> U { ty::Binder(f(self.0)) @@ -790,22 +790,22 @@ pub struct TyVid { #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct IntVid { - pub index: u32 + pub index: u32, } #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct FloatVid { - pub index: u32 + pub index: u32, } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub struct RegionVid { - pub index: u32 + pub index: u32, } #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct SkolemizedRegionVid { - pub index: u32 + pub index: u32, } #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] @@ -819,7 +819,7 @@ pub enum InferTy { /// `infer::freshen` for more details. FreshTy(u32), FreshIntTy(u32), - FreshFloatTy(u32) + FreshFloatTy(u32), } /// A `ProjectionPredicate` for an `ExistentialTraitRef`. @@ -827,7 +827,7 @@ pub enum InferTy { pub struct ExistentialProjection<'tcx> { pub trait_ref: ExistentialTraitRef<'tcx>, pub item_name: Name, - pub ty: Ty<'tcx> + pub ty: Ty<'tcx>, } pub type PolyExistentialProjection<'tcx> = Binder>; @@ -860,9 +860,9 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> { ty::ProjectionPredicate { projection_ty: ty::ProjectionTy { trait_ref: self.trait_ref.with_self_ty(tcx, self_ty), - item_name: self.item_name + item_name: self.item_name, }, - ty: self.ty + ty: self.ty, } } } @@ -899,7 +899,7 @@ impl Region { match *self { ty::ReEarlyBound(..) => true, ty::ReLateBound(..) => true, - _ => false + _ => false, } } @@ -969,7 +969,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_nil(&self) -> bool { match self.sty { TyTuple(ref tys, _) => tys.is_empty(), - _ => false + _ => false, } } @@ -1047,7 +1047,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_ty_var(&self) -> bool { match self.sty { TyInfer(TyVar(_)) => true, - _ => false + _ => false, } } @@ -1071,7 +1071,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_self(&self) -> bool { match self.sty { TyParam(ref p) => p.is_self(), - _ => false + _ => false, } } @@ -1088,7 +1088,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_structural(&self) -> bool { match self.sty { TyAdt(..) | TyTuple(..) | TyArray(..) | TyClosure(..) => true, - _ => self.is_slice() | self.is_trait() + _ => self.is_slice() | self.is_trait(), } } @@ -1096,7 +1096,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_simd(&self) -> bool { match self.sty { TyAdt(def, _) => def.repr.simd, - _ => false + _ => false, } } @@ -1127,7 +1127,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_region_ptr(&self) -> bool { match self.sty { TyRef(..) => true, - _ => false + _ => false, } } @@ -1145,7 +1145,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_unsafe_ptr(&self) -> bool { match self.sty { TyRawPtr(_) => return true, - _ => return false + _ => return false, } } @@ -1189,7 +1189,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_trait(&self) -> bool { match self.sty { TyDynamic(..) => true, - _ => false + _ => false, } } @@ -1205,7 +1205,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { TyInfer(FreshTy(_)) => true, TyInfer(FreshIntTy(_)) => true, TyInfer(FreshFloatTy(_)) => true, - _ => false + _ => false, } } @@ -1219,7 +1219,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_char(&self) -> bool { match self.sty { TyChar => true, - _ => false + _ => false, } } @@ -1237,7 +1237,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_signed(&self) -> bool { match self.sty { TyInt(_) => true, - _ => false + _ => false, } } @@ -1245,7 +1245,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { match self.sty { TyInt(ast::IntTy::Is) | TyUint(ast::UintTy::Us) => false, TyInt(..) | TyUint(..) | TyFloat(..) => true, - _ => false + _ => false, } } @@ -1276,7 +1276,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { }, TyRef(_, mt) => Some(mt), TyRawPtr(mt) if explicit => Some(mt), - _ => None + _ => None, } } @@ -1284,7 +1284,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn builtin_index(&self) -> Option> { match self.sty { TyArray(ty, _) | TySlice(ty) => Some(ty), - _ => None + _ => None, } } @@ -1307,7 +1307,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_fn(&self) -> bool { match self.sty { TyFnDef(..) | TyFnPtr(_) => true, - _ => false + _ => false, } } @@ -1316,14 +1316,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { TyDynamic(ref tt, ..) => tt.principal().map(|p| p.def_id()), TyAdt(def, _) => Some(def.did), TyClosure(id, _) => Some(id), - _ => None + _ => None, } } pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> { match self.sty { TyAdt(adt, _) => Some(adt), - _ => None + _ => None, } } diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index a81c3a177f885..fd95724990941 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -16,7 +16,7 @@ use infer::InferCtxt; use hir::map as hir_map; use traits::{self, Reveal}; use ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable}; -use ty::{ParameterEnvironment}; +use ty::ParameterEnvironment; use ty::fold::TypeVisitor; use ty::layout::{Layout, LayoutError}; use ty::TypeVariants::*; @@ -39,13 +39,13 @@ use hir; type Disr = ConstInt; - pub trait IntTypeExt { +pub trait IntTypeExt { fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>; fn disr_incr<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, val: Option) -> Option; fn assert_ty_matches(&self, val: Disr); fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Disr; - } +} macro_rules! typed_literal { @@ -133,7 +133,7 @@ impl IntTypeExt for attr::IntType { pub enum CopyImplementationError<'tcx> { InfrigingField(&'tcx ty::FieldDef), NotAnAdt, - HasDestructor + HasDestructor, } /// Describes whether a type is representable. For types that are not @@ -159,14 +159,14 @@ impl<'tcx> ParameterEnvironment<'tcx> { tcx.infer_ctxt(self.clone(), Reveal::UserFacing).enter(|infcx| { let (adt, substs) = match self_type.sty { ty::TyAdt(adt, substs) => (adt, substs), - _ => return Err(CopyImplementationError::NotAnAdt) + _ => return Err(CopyImplementationError::NotAnAdt), }; let field_implements_copy = |field: &ty::FieldDef| { let cause = traits::ObligationCause::dummy(); match traits::fully_normalize(&infcx, cause, &field.ty(tcx, substs)) { Ok(ty) => !infcx.type_moves_by_default(ty, span), - Err(..) => false + Err(..) => false, } }; @@ -198,7 +198,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } } - _ => () + _ => (), } false } @@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { adt.variants[0].fields.get(i).map(|f| f.ty(self, substs)) } (&TyTuple(ref v, _), None) => v.get(i).cloned(), - _ => None + _ => None, } } @@ -245,11 +245,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn struct_tail(self, mut ty: Ty<'tcx>) -> Ty<'tcx> { while let TyAdt(def, substs) = ty.sty { if !def.is_struct() { - break + break; } match def.struct_variant().fields.last() { Some(f) => ty = f.ty(self, substs), - None => break + None => break, } } ty @@ -267,14 +267,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let (mut a, mut b) = (source, target); while let (&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs)) = (&a.sty, &b.sty) { if a_def != b_def || !a_def.is_struct() { - break + break; } match a_def.struct_variant().fields.last() { Some(f) => { a = f.ty(self, a_substs); b = f.ty(self, b_substs); } - _ => break + _ => break, } } (a, b) @@ -373,7 +373,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let dtor_did = match dtor_did { Some(dtor) => dtor, - None => return None + None => return None, }; // RFC 1238: if the destructor method is tagged with the @@ -725,9 +725,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { substs_a.types().zip(substs_b.types()).all(|(a, b)| same_type(a, b)) } - _ => { - a == b - } + _ => a == b, } } diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 4ddccbfd4c597..7b5e2253109aa 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -94,7 +94,7 @@ pub fn to_readable_str(mut val: usize) -> String { if val == 0 { groups.push(format!("{}", group)); - break + break; } else { groups.push(format!("{:03}", group)); } @@ -142,7 +142,8 @@ fn get_resident() -> Option { type HANDLE = *mut u8; use libc::size_t; use std::mem; - #[repr(C)] #[allow(non_snake_case)] + #[repr(C)] + #[allow(non_snake_case)] struct PROCESS_MEMORY_COUNTERS { cb: DWORD, PageFaultCount: DWORD, @@ -184,7 +185,7 @@ pub fn indent(op: F) -> R where } pub struct Indenter { - _cannot_construct_outside_of_this_module: () + _cannot_construct_outside_of_this_module: (), } impl Drop for Indenter { diff --git a/src/librustc/util/fs.rs b/src/librustc/util/fs.rs index 3b4b3998c5745..da6a202e5afb2 100644 --- a/src/librustc/util/fs.rs +++ b/src/librustc/util/fs.rs @@ -116,7 +116,7 @@ pub fn create_dir_racy(path: &Path) -> io::Result<()> { match fs::create_dir(path) { Ok(()) => return Ok(()), Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => return Ok(()), - Err(ref e) if e.kind() == io::ErrorKind::NotFound => {} + Err(ref e) if e.kind() == io::ErrorKind::NotFound => (), Err(e) => return Err(e), } match path.parent() {