From 61729b3bf0e439ebe6cd785b3e6ae02ab24592c0 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 28 Jul 2019 14:36:26 +0300 Subject: [PATCH] tidy: Cleanup the directory whitelist --- .../owning_ref/mod.rs | 12 ++++++----- .../owning_ref/tests.rs | 20 ++++++++++++++----- src/tools/tidy/src/lib.rs | 20 ++++--------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/librustc_data_structures/owning_ref/mod.rs b/src/librustc_data_structures/owning_ref/mod.rs index a7af615fa5000..e9b33c13ff8a9 100644 --- a/src/librustc_data_structures/owning_ref/mod.rs +++ b/src/librustc_data_structures/owning_ref/mod.rs @@ -10,7 +10,7 @@ This allows moving and dropping of a `OwningRef` without needing to recreate the This can sometimes be useful because Rust borrowing rules normally prevent moving a type that has been moved from. For example, this kind of code gets rejected: -```rust,ignore +```compile_fail,E0515 fn return_owned_and_referenced<'a>() -> (Vec, &'a [u8]) { let v = vec![1, 2, 3, 4]; let s = &v[1..3]; @@ -43,7 +43,8 @@ and preventing mutable access to root containers, which in practice requires hea as provided by `Box`, `Rc`, etc. Also provided are typedefs for common owner type combinations, -which allow for less verbose type signatures. For example, `BoxRef` instead of `OwningRef, T>`. +which allow for less verbose type signatures. +For example, `BoxRef` instead of `OwningRef, T>`. The crate also provides the more advanced `OwningHandle` type, which allows more freedom in bundling a dependent handle object @@ -495,7 +496,8 @@ impl OwningRef { } } - /// Erases the concrete base type of the owner with a trait object which implements `Send` and `Sync`. + /// Erases the concrete base type of the owner with a trait object + /// which implements `Send` and `Sync`. /// /// This allows mixing of owned references with different owner base types. pub fn erase_send_sync_owner<'a>(self) -> OwningRef @@ -507,7 +509,7 @@ impl OwningRef { } } - // TODO: wrap_owner + // UNIMPLEMENTED: wrap_owner // FIXME: Naming convention? /// A getter for the underlying owner. @@ -753,7 +755,7 @@ impl OwningRefMut { } } - // TODO: wrap_owner + // UNIMPLEMENTED: wrap_owner // FIXME: Naming convention? /// A getter for the underlying owner. diff --git a/src/librustc_data_structures/owning_ref/tests.rs b/src/librustc_data_structures/owning_ref/tests.rs index d368219cab3eb..5bff5e035b529 100644 --- a/src/librustc_data_structures/owning_ref/tests.rs +++ b/src/librustc_data_structures/owning_ref/tests.rs @@ -274,7 +274,9 @@ mod owning_handle { use std::cell::RefCell; let cell = Rc::new(RefCell::new(2)); let cell_ref = RcRef::new(cell); - let mut handle = OwningHandle::new_with_fn(cell_ref, |x| unsafe { x.as_ref() }.unwrap().borrow_mut()); + let mut handle = OwningHandle::new_with_fn(cell_ref, |x| { + unsafe { x.as_ref() }.unwrap().borrow_mut() + }); assert_eq!(*handle, 2); *handle = 3; assert_eq!(*handle, 3); @@ -319,8 +321,12 @@ mod owning_handle { let result = { let complex = Rc::new(RefCell::new(Arc::new(RwLock::new("someString")))); let curr = RcRef::new(complex); - let curr = OwningHandle::new_with_fn(curr, |x| unsafe { x.as_ref() }.unwrap().borrow_mut()); - let mut curr = OwningHandle::new_with_fn(curr, |x| unsafe { x.as_ref() }.unwrap().try_write().unwrap()); + let curr = OwningHandle::new_with_fn(curr, |x| { + unsafe { x.as_ref() }.unwrap().borrow_mut() + }); + let mut curr = OwningHandle::new_with_fn(curr, |x| { + unsafe { x.as_ref() }.unwrap().try_write().unwrap() + }); assert_eq!(*curr, "someString"); *curr = "someOtherString"; curr @@ -353,8 +359,12 @@ mod owning_handle { let result = { let complex = Rc::new(RefCell::new(Arc::new(RwLock::new("someString")))); let curr = RcRef::new(complex); - let curr = OwningHandle::new_with_fn(curr, |x| unsafe { x.as_ref() }.unwrap().borrow_mut()); - let mut curr = OwningHandle::new_with_fn(curr, |x| unsafe { x.as_ref() }.unwrap().try_write().unwrap()); + let curr = OwningHandle::new_with_fn(curr, |x| { + unsafe { x.as_ref() }.unwrap().borrow_mut() + }); + let mut curr = OwningHandle::new_with_fn(curr, |x| { + unsafe { x.as_ref() }.unwrap().try_write().unwrap() + }); assert_eq!(*curr, "someString"); *curr = "someOtherString"; curr diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 3d40bdced63e0..eca8001a9d2a1 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -43,31 +43,19 @@ pub mod unstable_book; fn filter_dirs(path: &Path) -> bool { let skip = [ - "src/llvm", - "src/llvm-project", "src/llvm-emscripten", - "src/libbacktrace", - "src/librustc_data_structures/owning_ref", - "src/vendor", + "src/llvm-project", + "src/stdarch", "src/tools/cargo", - "src/tools/clang", - "src/tools/rls", "src/tools/clippy", + "src/tools/miri", + "src/tools/rls", "src/tools/rust-installer", "src/tools/rustfmt", - "src/tools/miri", - "src/tools/lld", - "src/tools/lldb", - "src/target", - "src/stdarch", - "src/rust-sgx", - "target", - "vendor", ]; skip.iter().any(|p| path.ends_with(p)) } - fn walk_many( paths: &[&Path], skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&DirEntry, &str) ) {