diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-08-28 10:54:12 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:04:33 +0100 |
commit | 342b071a0fac00d8acf745348c41afcd48cdb4cb (patch) | |
tree | f9f33064139d7eddb76bba85020d23896990f651 /gcc/rust/util/rust-hir-map.cc | |
parent | c8911dde92a98f1c9230a04c62a5287b562bc720 (diff) | |
download | gcc-342b071a0fac00d8acf745348c41afcd48cdb4cb.zip gcc-342b071a0fac00d8acf745348c41afcd48cdb4cb.tar.gz gcc-342b071a0fac00d8acf745348c41afcd48cdb4cb.tar.bz2 |
gccrs: resolver: Refactor assertion
Change the condition with rust_unreachable to an assertion. This will
keep the code clean and concise.
Some styling issues appeared during review, this commit make the code
more readable.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Change to assertion.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Add empty line.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.cc')
-rw-r--r-- | gcc/rust/util/rust-hir-map.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index 8ac957f..7041aaa 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -978,6 +978,7 @@ Mappings::lookup_derive_proc_macros (CrateNum num) auto it = procmacrosDeriveMappings.find (num); if (it == procmacrosDeriveMappings.end ()) return tl::nullopt; + return it->second; } @@ -987,6 +988,7 @@ Mappings::lookup_bang_proc_macros (CrateNum num) auto it = procmacrosBangMappings.find (num); if (it == procmacrosBangMappings.end ()) return tl::nullopt; + return it->second; } @@ -996,6 +998,7 @@ Mappings::lookup_attribute_proc_macros (CrateNum num) auto it = procmacrosAttributeMappings.find (num); if (it == procmacrosAttributeMappings.end ()) return tl::nullopt; + return it->second; } |