]> git.lizzy.rs Git - rust.git/commit
Avoid some clones.
authorNicholas Nethercote <n.nethercote@gmail.com>
Thu, 25 Aug 2022 04:05:01 +0000 (14:05 +1000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Thu, 1 Sep 2022 21:26:22 +0000 (07:26 +1000)
commitbd1e6836a07fa7b96b41effc3ec90e60aaa494df
tree550f41080a5e88fd8dc83261aa9c5b1c0721e10e
parent053874eecc9806f36195c35a7fad9c8878b0788e
Avoid some clones.

`Builder::expr_into_pattern` has a single call site. Currently the
`pattern` argument at the call site is always cloned.

This commit changes things so that we instead do a clone within
`expr_into_pattern`, but only if the pattern has the
`PatKind::AscribeUserType` kind, and we only clone the annotation within
the pattern instead of the entire pattern.
compiler/rustc_mir_build/src/build/block.rs
compiler/rustc_mir_build/src/build/matches/mod.rs
compiler/rustc_mir_build/src/build/mod.rs