Skip to content

Commit f17e384

Browse files
committed
use convention for with_* methods
1 parent e3f07b2 commit f17e384

File tree

1 file changed

+9
-7
lines changed
  • compiler/rustc_target/src/abi

1 file changed

+9
-7
lines changed

Diff for: compiler/rustc_target/src/abi/mod.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -713,16 +713,18 @@ impl WrappingRange {
713713
self.start > self.end || self.start == 0
714714
}
715715

716-
/// Returns new `WrappingRange` with replaced `start`
716+
/// Returns `self` with replaced `start`
717717
#[inline(always)]
718-
pub fn with_start(&self, start: u128) -> Self {
719-
Self { start, end: self.end }
718+
pub fn with_start(mut self, start: u128) -> Self {
719+
self.start = start;
720+
self
720721
}
721722

722-
/// Returns new `WrappingRange` with replaced `end`
723+
/// Returns `self` with replaced `end`
723724
#[inline(always)]
724-
pub fn with_end(&self, end: u128) -> Self {
725-
Self { start: self.start, end }
725+
pub fn with_end(mut self, end: u128) -> Self {
726+
self.end = end;
727+
self
726728
}
727729
}
728730

@@ -1024,7 +1026,7 @@ impl Niche {
10241026
pub fn reserve<C: HasDataLayout>(&self, cx: &C, count: u128) -> Option<(u128, Scalar)> {
10251027
assert!(count > 0);
10261028

1027-
let Scalar { value, valid_range: ref v } = self.scalar;
1029+
let Scalar { value, valid_range: v } = self.scalar.clone();
10281030
let bits = value.size(cx).bits();
10291031
assert!(bits <= 128);
10301032
let max_value = !0u128 >> (128 - bits);

0 commit comments

Comments
 (0)