diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-04-06 17:03:42 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-04-06 17:03:42 +0000 |
| commit | b6970d0e260aa33bb1e22ae7df739470ecad19e0 (patch) | |
| tree | 6e9ab3d40f5c6e5373b6afd239f52f77bff41f2d /compiler/rustc_data_structures/src | |
| parent | 504c4c40e9716fb47346d6e8a27389467763552a (diff) | |
| download | rust-b6970d0e260aa33bb1e22ae7df739470ecad19e0.tar.gz rust-b6970d0e260aa33bb1e22ae7df739470ecad19e0.zip | |
Use `FnOnce` for `slice_owned` instead of `Fn`
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/owned_slice.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_data_structures/src/owned_slice.rs b/compiler/rustc_data_structures/src/owned_slice.rs index 146f06a1c69..e35a93f2a1d 100644 --- a/compiler/rustc_data_structures/src/owned_slice.rs +++ b/compiler/rustc_data_structures/src/owned_slice.rs @@ -59,7 +59,7 @@ pub struct OwnedSlice { pub fn slice_owned<O, F>(owner: O, slicer: F) -> OwnedSlice where O: Send + Sync + 'static, - F: Fn(&O) -> &[u8], + F: FnOnce(&O) -> &[u8], { try_slice_owned(owner, |x| Ok::<_, !>(slicer(x))).into_ok() } @@ -70,7 +70,7 @@ where pub fn try_slice_owned<O, F, E>(owner: O, slicer: F) -> Result<OwnedSlice, E> where O: Send + Sync + 'static, - F: Fn(&O) -> Result<&[u8], E>, + F: FnOnce(&O) -> Result<&[u8], E>, { // We box the owner of the bytes, so it doesn't move. // |
