Skip to content

Commit a7d39b8

Browse files
committed
fix(from_low_high): Renamed according to clippy requirements
Changed for clippy naming convention requirement: ``` warning: methods called `from_*` usually take no `self` --> src/int.rs:996:22 | 996 | fn from_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> { | ^^^^^ | = help: consider choosing a less ambiguous name = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention = note: `#[warn(clippy::wrong_self_convention)]` on by default ```
1 parent 3fd9db3 commit a7d39b8

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/int.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
3838
self.cx.context.new_unary_op(self.location, operation, typ, a)
3939
} else {
4040
let element_type = typ.dyncast_array().expect("element type");
41-
self.from_low_high_rvalues(
41+
self.concat_low_high_rvalues(
4242
typ,
4343
self.cx.context.new_unary_op(
4444
self.location,
@@ -112,7 +112,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
112112
let shift_value = self.gcc_sub(b, sixty_four);
113113
let high = self.high(a);
114114
let sign = if a_type.is_signed(self) { high >> sixty_three } else { zero };
115-
let array_value = self.from_low_high_rvalues(a_type, high >> shift_value, sign);
115+
let array_value = self.concat_low_high_rvalues(a_type, high >> shift_value, sign);
116116
then_block.add_assignment(self.location, result, array_value);
117117
then_block.end_with_jump(self.location, after_block);
118118

@@ -128,8 +128,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
128128
let casted_low = self.context.new_cast(self.location, self.low(a), unsigned_type);
129129
let shifted_low = casted_low >> self.context.new_cast(self.location, b, unsigned_type);
130130
let shifted_low = self.context.new_cast(self.location, shifted_low, native_int_type);
131-
let array_value =
132-
self.from_low_high_rvalues(a_type, (high << shift_value) | shifted_low, high >> b);
131+
let array_value = self.concat_low_high_rvalues(
132+
a_type,
133+
(high << shift_value) | shifted_low,
134+
high >> b,
135+
);
133136
actual_else_block.add_assignment(self.location, result, array_value);
134137
actual_else_block.end_with_jump(self.location, after_block);
135138

@@ -610,7 +613,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
610613
{
611614
a ^ b
612615
} else {
613-
self.from_low_high_rvalues(
616+
self.concat_low_high_rvalues(
614617
a_type,
615618
self.low(a) ^ self.low(b),
616619
self.high(a) ^ self.high(b),
@@ -659,7 +662,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
659662
self.llbb().end_with_conditional(self.location, condition, then_block, else_block);
660663

661664
let array_value =
662-
self.from_low_high_rvalues(a_type, zero, self.low(a) << (b - sixty_four));
665+
self.concat_low_high_rvalues(a_type, zero, self.low(a) << (b - sixty_four));
663666
then_block.add_assignment(self.location, result, array_value);
664667
then_block.end_with_jump(self.location, after_block);
665668

@@ -677,7 +680,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
677680
let high_low =
678681
self.context.new_cast(self.location, casted_low >> shift_value, native_int_type);
679682

680-
let array_value = self.from_low_high_rvalues(
683+
let array_value = self.concat_low_high_rvalues(
681684
a_type,
682685
self.low(a) << b,
683686
(self.high(a) << b) | high_low,
@@ -706,7 +709,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
706709

707710
// NOTE: we also need to swap the two elements here, in addition to swapping inside
708711
// the elements themselves like done above.
709-
return self.from_low_high_rvalues(arg_type, swapped_msb, swapped_lsb);
712+
return self.concat_low_high_rvalues(arg_type, swapped_msb, swapped_lsb);
710713
}
711714

712715
// TODO(antoyo): check if it's faster to use string literals and a
@@ -728,7 +731,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
728731
self.context.new_rvalue_from_long(typ, int)
729732
} else {
730733
// NOTE: set the sign in high.
731-
self.from_low_high(typ, int, -(int.is_negative() as i64))
734+
self.concat_low_high(typ, int, -(int.is_negative() as i64))
732735
}
733736
}
734737

@@ -740,7 +743,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
740743
} else if self.is_native_int_type_or_bool(typ) {
741744
self.context.new_rvalue_from_long(typ, int as i64)
742745
} else {
743-
self.from_low_high(typ, int as i64, 0)
746+
self.concat_low_high(typ, int as i64, 0)
744747
}
745748
}
746749

@@ -757,7 +760,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
757760
let shift = high << sixty_four;
758761
shift | self.context.new_cast(None, low, typ)
759762
} else {
760-
self.from_low_high(typ, low as i64, high as i64)
763+
self.concat_low_high(typ, low as i64, high as i64)
761764
}
762765
} else if typ.is_i128(self) {
763766
// FIXME(antoyo): libgccjit cannot create 128-bit values yet.
@@ -772,7 +775,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
772775
if self.is_native_int_type_or_bool(typ) {
773776
self.context.new_rvalue_zero(typ)
774777
} else {
775-
self.from_low_high(typ, 0, 0)
778+
self.concat_low_high(typ, 0, 0)
776779
}
777780
}
778781

@@ -810,7 +813,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
810813
"both types should either be native or non-native for or operation"
811814
);
812815
let native_int_type = a_type.dyncast_array().expect("get element type");
813-
self.from_low_high_rvalues(
816+
self.concat_low_high_rvalues(
814817
a_type,
815818
self.context.new_binary_op(
816819
loc,
@@ -855,7 +858,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
855858
let is_negative =
856859
self.context.new_comparison(None, ComparisonOp::LessThan, value, zero);
857860
let is_negative = self.gcc_int_cast(is_negative, dest_element_type);
858-
self.from_low_high_rvalues(
861+
self.concat_low_high_rvalues(
859862
dest_typ,
860863
self.context.new_cast(None, value, dest_element_type),
861864
self.context.new_unary_op(None, UnaryOp::Minus, dest_element_type, is_negative),
@@ -975,7 +978,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
975978
.to_rvalue()
976979
}
977980

978-
fn from_low_high_rvalues(
981+
fn concat_low_high_rvalues(
979982
&self,
980983
typ: Type<'gcc>,
981984
low: RValue<'gcc>,
@@ -990,7 +993,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
990993
self.context.new_array_constructor(None, typ, &values)
991994
}
992995

993-
fn from_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
996+
fn concat_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
994997
let (first, last) = match self.sess().target.options.endian {
995998
Endian::Little => (low, high),
996999
Endian::Big => (high, low),

0 commit comments

Comments
 (0)