Skip to content

Commit 47790b8

Browse files
committed
inherent-impl-check: Fix formatting
1 parent 9a63836 commit 47790b8

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

gcc/rust/typecheck/rust-hir-inherent-impl-check.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2020-2025 Free Software Foundation, Inc.
1+
// Copyright (C) 2025 Free Software Foundation, Inc.
22

33
// This file is part of GCC.
44

@@ -39,32 +39,34 @@ class PrimitiveImplCheck : public TypeCheckBase
3939

4040
private:
4141
void scan ()
42-
4342
{
44-
std::vector<HIR::ImplBlock *> possible_primitive_impl;
43+
std::vector<HIR::ImplBlock *> possible_primitive_impls;
44+
4545
mappings.iterate_impl_blocks ([&] (HirId id, HIR::ImplBlock *impl) -> bool {
4646
// filtering trait-impl-blocks
4747
if (impl->has_trait_ref ())
4848
return true;
49+
4950
HirId impl_ty_id = impl->get_type ().get_mappings ().get_hirid ();
51+
5052
TyTy::BaseType *impl_type = nullptr;
5153
if (!query_type (impl_ty_id, &impl_type))
5254
return true;
55+
5356
DefId defid = impl->get_mappings ().get_defid ();
57+
5458
// ignore lang item
5559
if (mappings.lookup_lang_item (defid))
5660
return true;
61+
5762
if (is_primitive_type_kind (impl_type->get_kind ()))
58-
{
59-
possible_primitive_impl.push_back (impl);
60-
}
63+
possible_primitive_impls.push_back (impl);
64+
6165
return true;
6266
});
6367

64-
for (auto impl : possible_primitive_impl)
65-
{
66-
report_error (impl);
67-
}
68+
for (auto impl : possible_primitive_impls)
69+
report_error (impl);
6870
}
6971

7072
void report_error (HIR::ImplBlock *impl)
@@ -73,8 +75,9 @@ class PrimitiveImplCheck : public TypeCheckBase
7375
std::string msg = "consider using an extension trait instead";
7476
r.add_fixit_replace (impl->get_locus (), msg.c_str ());
7577
r.add_range (impl->get_locus ());
76-
std::string err = "impl";
77-
err = "cannot define inherent `" + err + "` for primitive types";
78+
79+
std::string err = "cannot define inherent impl for primitive types";
80+
7881
rust_error_at (r, ErrorCode::E0390, "%s", err.c_str ());
7982
}
8083
};

0 commit comments

Comments
 (0)