diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-28 21:20:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-28 21:20:00 +0200 |
| commit | 155bfe461258de55a34ca4027a4d5b5c0e64209f (patch) | |
| tree | 9db8abbedc59aa00d1845b7fc7e96d01c82af4f7 | |
| parent | 117fa1de982da53977692c4636d58730c8a75b10 (diff) | |
| parent | 61729b3bf0e439ebe6cd785b3e6ae02ab24592c0 (diff) | |
| download | rust-155bfe461258de55a34ca4027a4d5b5c0e64209f.tar.gz rust-155bfe461258de55a34ca4027a4d5b5c0e64209f.zip | |
Rollup merge of #63081 - petrochenkov:cleantidy, r=Mark-Simulacrum
tidy: Cleanup the directory whitelist Some entries were outdated - pre-"llvm-project", pre-"crates.io", pre-"Cargo.toml outside of src". Some entries were unnecessary - `owning_ref` could be fixed and directories outside of `src` are not visited by tidy at all. r? @Mark-Simulacrum
| -rw-r--r-- | src/librustc_data_structures/owning_ref/mod.rs | 12 | ||||
| -rw-r--r-- | src/librustc_data_structures/owning_ref/tests.rs | 20 | ||||
| -rw-r--r-- | 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 a7af615fa50..e9b33c13ff8 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<u8>, &'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<T>`, `Rc<T>`, etc. Also provided are typedefs for common owner type combinations, -which allow for less verbose type signatures. For example, `BoxRef<T>` instead of `OwningRef<Box<T>, T>`. +which allow for less verbose type signatures. +For example, `BoxRef<T>` instead of `OwningRef<Box<T>, 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<O, T: ?Sized> OwningRef<O, T> { } } - /// 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<O::Erased, T> @@ -507,7 +509,7 @@ impl<O, T: ?Sized> OwningRef<O, T> { } } - // TODO: wrap_owner + // UNIMPLEMENTED: wrap_owner // FIXME: Naming convention? /// A getter for the underlying owner. @@ -753,7 +755,7 @@ impl<O, T: ?Sized> OwningRefMut<O, T> { } } - // 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 d368219cab3..5bff5e035b5 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 3d40bdced63..eca8001a9d2 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) ) { |
