Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few updates to improve code clarity #6777

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sharma-shray
Copy link

Description

type anotation, extracting the creation of the CallPath into a separate variable for easier understanding, Inline Destructuring for Simpler Match Pattern

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • [] I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

type anotation, extracting the creation of the CallPath into a separate variable for easier understanding, Inline Destructuring for Simpler Match Pattern
@sharma-shray sharma-shray requested review from a team as code owners December 7, 2024 20:21
@fuel-cla-bot
Copy link

fuel-cla-bot bot commented Dec 7, 2024

Thanks for the contribution! Before we can merge this, we need @sharma-shray to sign the Fuel Labs Contributor License Agreement.

@@ -4178,7 +4178,7 @@ impl<'eng> FnCompiler<'eng> {
.get_elem_ptr_with_idx(tuple_value, field_type, idx as u64)
.add_metadatum(context, span_md_idx)
})
.ok_or_else(|| {
.ok_or({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These do not have the same behavior.
There is no need to eagerly evaluate an error, surely?

Comment on lines -1837 to -1838
// FIXME we can do better here and return function application expression here
// if there are no parsing errors in the arguments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale for removing this altogether?

Comment on lines +2492 to +2501
let call_path = CallPath {
prefixes: vec![
Ident::new_with_override("core".into(), op_span.clone()),
Ident::new_with_override("ops".into(), op_span.clone()),
],
suffix: Ident::new_with_override(name.into(), op_span.clone()),
is_absolute: true,
};
let method_name_binding = TypeBinding {
inner: MethodName::FromTrait {
call_path: CallPath {
prefixes: vec![
Ident::new_with_override("core".into(), op_span.clone()),
Ident::new_with_override("ops".into(), op_span.clone()),
],
suffix: Ident::new_with_override(name.into(), op_span.clone()),
is_absolute: true,
},
},
inner: MethodName::FromTrait { call_path },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how breaking it out makes it clearer here. You've undone it in other instances in this very PR.

Copy link

codspeed-hq bot commented Dec 9, 2024

CodSpeed Performance Report

Merging #6777 will not alter performance

Comparing sharma-shray:master (e4dcb3b) with master (ff8291a)

Summary

✅ 22 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants