Skip to content

Commit 264ff89

Browse files
eduardosmAmanieu
authored andcommitted
Remove unneeded borrows
1 parent 51bfc43 commit 264ff89

File tree

5 files changed

+44
-44
lines changed

5 files changed

+44
-44
lines changed

stdarch/crates/intrinsic-test/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ fn build_c(notices: &str, intrinsics: &Vec<Intrinsic>, compiler: Option<&str>, a
266266
let c_filename = format!(r#"c_programs/{}.cpp"#, i.name);
267267
let mut file = File::create(&c_filename).unwrap();
268268

269-
let c_code = generate_c_program(notices, &["arm_neon.h", "arm_acle.h"], &i, a32);
269+
let c_code = generate_c_program(notices, &["arm_neon.h", "arm_acle.h"], i, a32);
270270
file.write_all(c_code.into_bytes().as_slice()).unwrap();
271271
match compiler {
272272
None => true,
273-
Some(compiler) => compile_c(&c_filename, &i, compiler, a32),
273+
Some(compiler) => compile_c(&c_filename, i, compiler, a32),
274274
}
275275
})
276276
.find_any(|x| !x)
@@ -284,7 +284,7 @@ fn build_rust(notices: &str, intrinsics: &[Intrinsic], toolchain: Option<&str>,
284284
let rust_filename = format!(r#"{rust_dir}/main.rs"#);
285285
let mut file = File::create(&rust_filename).unwrap();
286286

287-
let c_code = generate_rust_program(notices, &i, a32);
287+
let c_code = generate_rust_program(notices, i, a32);
288288
file.write_all(c_code.into_bytes().as_slice()).unwrap();
289289
});
290290

stdarch/crates/stdarch-gen/src/main.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,15 +1638,15 @@ fn gen_aarch64(
16381638
Fntype::Normal => gen_test(
16391639
&name,
16401640
in_t,
1641-
&out_t,
1641+
out_t,
16421642
current_tests,
16431643
[type_len(in_t[0]), type_len(in_t[1]), type_len(in_t[2])],
16441644
type_len(out_t),
16451645
para_num,
16461646
target.to_simd_test_attr_aarch64(),
16471647
),
1648-
Fntype::Load => gen_load_test(&name, in_t, &out_t, current_tests, type_len(out_t)),
1649-
Fntype::Store => gen_store_test(&name, in_t, &out_t, current_tests, type_len(in_t[1])),
1648+
Fntype::Load => gen_load_test(&name, in_t, out_t, current_tests, type_len(out_t)),
1649+
Fntype::Store => gen_store_test(&name, in_t, out_t, current_tests, type_len(in_t[1])),
16501650
};
16511651
(function, test)
16521652
}
@@ -2524,7 +2524,7 @@ fn gen_arm(
25242524
"#,
25252525
target_feature_arm = target.to_target_feature_attr_arm(),
25262526
target_feature_aarch64 = target.to_target_feature_attr_aarch64(),
2527-
assert_arm = expand_intrinsic(&current_arm, in_t[1]),
2527+
assert_arm = expand_intrinsic(current_arm, in_t[1]),
25282528
assert_aarch64 = expand_intrinsic(&current_aarch64, in_t[1]),
25292529
)
25302530
} else {
@@ -2573,7 +2573,7 @@ fn gen_arm(
25732573
{call}
25742574
"#,
25752575
function_doc = create_doc_string(current_comment, &name),
2576-
assert_arm = expand_intrinsic(&current_arm, in_t[1]),
2576+
assert_arm = expand_intrinsic(current_arm, in_t[1]),
25772577
assert_aarch64 = expand_intrinsic(&current_aarch64, in_t[1]),
25782578
target_feature = target.to_target_feature_attr_shared(),
25792579
)
@@ -2582,15 +2582,15 @@ fn gen_arm(
25822582
Fntype::Normal => gen_test(
25832583
&name,
25842584
in_t,
2585-
&out_t,
2585+
out_t,
25862586
current_tests,
25872587
[type_len(in_t[0]), type_len(in_t[1]), type_len(in_t[2])],
25882588
type_len(out_t),
25892589
para_num,
25902590
target.to_simd_test_attr_shared(),
25912591
),
2592-
Fntype::Load => gen_load_test(&name, in_t, &out_t, current_tests, type_len(out_t)),
2593-
Fntype::Store => gen_store_test(&name, in_t, &out_t, current_tests, type_len(in_t[1])),
2592+
Fntype::Load => gen_load_test(&name, in_t, out_t, current_tests, type_len(out_t)),
2593+
Fntype::Store => gen_store_test(&name, in_t, out_t, current_tests, type_len(in_t[1])),
25942594
};
25952595
(function, test)
25962596
}
@@ -3085,11 +3085,11 @@ fn get_call(
30853085
} else if fn_format[1] == "outsigned" {
30863086
fn_name.push_str(type_to_suffix(&type_to_signed(&String::from(out_t))));
30873087
} else if fn_format[1] == "outsignednox" {
3088-
fn_name.push_str(&type_to_suffix(&type_to_sub_type(&type_to_signed(
3088+
fn_name.push_str(type_to_suffix(&type_to_sub_type(&type_to_signed(
30893089
&String::from(out_t),
30903090
))));
30913091
} else if fn_format[1] == "in1signednox" {
3092-
fn_name.push_str(&type_to_suffix(&type_to_sub_type(&type_to_signed(
3092+
fn_name.push_str(type_to_suffix(&type_to_sub_type(&type_to_signed(
30933093
&String::from(in_t[1]),
30943094
))));
30953095
} else if fn_format[1] == "outsigneddupnox" {
@@ -3451,7 +3451,7 @@ mod test {
34513451
&const_aarch64,
34523452
&constn,
34533453
&in_t,
3454-
&out_t,
3454+
out_t,
34553455
&current_tests,
34563456
suffix,
34573457
para_num,
@@ -3473,7 +3473,7 @@ mod test {
34733473
&const_aarch64,
34743474
&constn,
34753475
&in_t,
3476-
&out_t,
3476+
out_t,
34773477
&current_tests,
34783478
suffix,
34793479
para_num,

stdarch/crates/stdarch-verify/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ struct RustcArgsRequiredConst {
536536

537537
impl syn::parse::Parse for RustcArgsRequiredConst {
538538
fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
539-
let list = syn::punctuated::Punctuated::<syn::LitInt, Token![,]>::parse_terminated(&input)?;
539+
let list = syn::punctuated::Punctuated::<syn::LitInt, Token![,]>::parse_terminated(input)?;
540540
Ok(Self {
541541
args: list
542542
.into_iter()

stdarch/crates/stdarch-verify/tests/mips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl std::convert::TryFrom<&'static str> for MsaIntrinsic {
163163
let mut arg_tys = Vec::new();
164164

165165
let last_parentheses = line.find(')')?;
166-
for arg in (&line[first_parentheses + 1..last_parentheses]).split(',') {
166+
for arg in line[first_parentheses + 1..last_parentheses].split(',') {
167167
let arg = arg.trim();
168168
arg_tys.push(MsaTy::from(arg));
169169
}

stdarch/examples/connect5.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ fn side_opp(sd: Side) -> Side {
406406

407407
fn pos_is_winner(pos: &Pos) -> bool {
408408
let current_side = side_opp(pos.p_turn);
409-
check_pattern5(&pos, current_side)
409+
check_pattern5(pos, current_side)
410410
}
411411

412412
fn pos_is_draw(pos: &Pos) -> bool {
@@ -506,38 +506,38 @@ fn search(pos: &Pos, alpha: i32, beta: i32, depth: i32, _ply: i32) -> i32 {
506506
{
507507
if is_x86_feature_detected!("avx512bw") {
508508
unsafe {
509-
if pos_is_winner_avx512(&pos) {
509+
if pos_is_winner_avx512(pos) {
510510
return -EVAL_INF + _ply;
511511
}
512512

513-
if pos_is_draw_avx512(&pos) {
513+
if pos_is_draw_avx512(pos) {
514514
return 0;
515515
}
516516
}
517517
} else {
518-
if pos_is_winner(&pos) {
518+
if pos_is_winner(pos) {
519519
return -EVAL_INF + _ply;
520520
}
521521

522-
if pos_is_draw(&pos) {
522+
if pos_is_draw(pos) {
523523
return 0;
524524
}
525525
}
526526
}
527527

528528
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
529529
{
530-
if pos_is_winner(&pos) {
530+
if pos_is_winner(pos) {
531531
return -EVAL_INF + _ply;
532532
}
533533

534-
if pos_is_draw(&pos) {
534+
if pos_is_draw(pos) {
535535
return 0;
536536
}
537537
}
538538

539539
if depth == 0 {
540-
return eval(&pos, _ply);
540+
return eval(pos, _ply);
541541
}
542542

543543
let p_move_new: [Move; (FILE_SIZE * RANK_SIZE) as usize] =
@@ -551,7 +551,7 @@ fn search(pos: &Pos, alpha: i32, beta: i32, depth: i32, _ply: i32) -> i32 {
551551
let mut bm: Move = MOVE_NONE;
552552
let mut bs: i32 = SCORE_NONE;
553553

554-
gen_moves(&mut list, &pos);
554+
gen_moves(&mut list, pos);
555555

556556
// move loop
557557

@@ -600,20 +600,20 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
600600
{
601601
if is_x86_feature_detected!("avx512bw") {
602602
unsafe {
603-
if check_patternlive4_avx512(&pos, def) {
603+
if check_patternlive4_avx512(pos, def) {
604604
return -4096;
605605
}
606606
}
607607
} else {
608-
if check_patternlive4(&pos, def) {
608+
if check_patternlive4(pos, def) {
609609
return -4096;
610610
}
611611
}
612612
}
613613

614614
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
615615
{
616-
if check_patternlive4(&pos, def) {
616+
if check_patternlive4(pos, def) {
617617
return -4096;
618618
}
619619
}
@@ -623,20 +623,20 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
623623
{
624624
if is_x86_feature_detected!("avx512bw") {
625625
unsafe {
626-
if check_patternlive4_avx512(&pos, atk) {
626+
if check_patternlive4_avx512(pos, atk) {
627627
return 2560;
628628
}
629629
}
630630
} else {
631-
if check_patternlive4(&pos, atk) {
631+
if check_patternlive4(pos, atk) {
632632
return 2560;
633633
}
634634
}
635635
}
636636

637637
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
638638
{
639-
if check_patternlive4(&pos, atk) {
639+
if check_patternlive4(pos, atk) {
640640
return 2560;
641641
}
642642
}
@@ -646,20 +646,20 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
646646
{
647647
if is_x86_feature_detected!("avx512bw") {
648648
unsafe {
649-
if check_patterndead4_avx512(&pos, atk) > 0 {
649+
if check_patterndead4_avx512(pos, atk) > 0 {
650650
return 2560;
651651
}
652652
}
653653
} else {
654-
if check_patterndead4(&pos, atk) > 0 {
654+
if check_patterndead4(pos, atk) > 0 {
655655
return 2560;
656656
}
657657
}
658658
}
659659

660660
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
661661
{
662-
if check_patterndead4(&pos, atk) > 0 {
662+
if check_patterndead4(pos, atk) > 0 {
663663
return 2560;
664664
}
665665
}
@@ -668,8 +668,8 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
668668
{
669669
if is_x86_feature_detected!("avx512bw") {
670670
unsafe {
671-
let n_c4: i32 = check_patterndead4_avx512(&pos, def);
672-
let n_c3: i32 = check_patternlive3_avx512(&pos, def);
671+
let n_c4: i32 = check_patterndead4_avx512(pos, def);
672+
let n_c3: i32 = check_patternlive3_avx512(pos, def);
673673

674674
// check if opp has 2 dead4 which will win playing next move
675675
if n_c4 > 1 {
@@ -681,7 +681,7 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
681681
return -2048;
682682
}
683683

684-
if check_patternlive3_avx512(&pos, atk) > 1 {
684+
if check_patternlive3_avx512(pos, atk) > 1 {
685685
return 2560;
686686
}
687687

@@ -691,8 +691,8 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
691691
}
692692
}
693693
} else {
694-
let n_c4: i32 = check_patterndead4(&pos, def);
695-
let n_c3: i32 = check_patternlive3(&pos, def);
694+
let n_c4: i32 = check_patterndead4(pos, def);
695+
let n_c3: i32 = check_patternlive3(pos, def);
696696

697697
// check if opp has 2 dead4 which will win playing next move
698698
if n_c4 > 1 {
@@ -705,7 +705,7 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
705705
}
706706

707707
// check if self has 2 live3 which will win playing the next two move
708-
if check_patternlive3(&pos, atk) > 1 {
708+
if check_patternlive3(pos, atk) > 1 {
709709
return 2560;
710710
}
711711

@@ -718,8 +718,8 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
718718

719719
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
720720
{
721-
let n_c4: i32 = check_patterndead4(&pos, def);
722-
let n_c3: i32 = check_patternlive3(&pos, def);
721+
let n_c4: i32 = check_patterndead4(pos, def);
722+
let n_c3: i32 = check_patternlive3(pos, def);
723723

724724
// check if opp has 2 dead4 which will win playing next move
725725
if n_c4 > 1 {
@@ -732,7 +732,7 @@ fn eval(pos: &Pos, _ply: i32) -> i32 {
732732
}
733733

734734
// check if self has 2 live3 which will win playing the next two move
735-
if check_patternlive3(&pos, atk) > 1 {
735+
if check_patternlive3(pos, atk) > 1 {
736736
return 2560;
737737
}
738738

0 commit comments

Comments
 (0)