Skip to content

Commit b6970d0

Browse files
committed
Use FnOnce for slice_owned instead of Fn
1 parent 504c4c4 commit b6970d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct DefaultMetadataLoader;
3737

3838
fn load_metadata_with(
3939
path: &Path,
40-
f: impl for<'a> Fn(&'a [u8]) -> Result<&'a [u8], String>,
40+
f: impl for<'a> FnOnce(&'a [u8]) -> Result<&'a [u8], String>,
4141
) -> Result<MetadataRef, String> {
4242
let file =
4343
File::open(path).map_err(|e| format!("failed to open file '{}': {}", path.display(), e))?;

compiler/rustc_data_structures/src/owned_slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct OwnedSlice {
5959
pub fn slice_owned<O, F>(owner: O, slicer: F) -> OwnedSlice
6060
where
6161
O: Send + Sync + 'static,
62-
F: Fn(&O) -> &[u8],
62+
F: FnOnce(&O) -> &[u8],
6363
{
6464
try_slice_owned(owner, |x| Ok::<_, !>(slicer(x))).into_ok()
6565
}
@@ -70,7 +70,7 @@ where
7070
pub fn try_slice_owned<O, F, E>(owner: O, slicer: F) -> Result<OwnedSlice, E>
7171
where
7272
O: Send + Sync + 'static,
73-
F: Fn(&O) -> Result<&[u8], E>,
73+
F: FnOnce(&O) -> Result<&[u8], E>,
7474
{
7575
// We box the owner of the bytes, so it doesn't move.
7676
//

0 commit comments

Comments
 (0)