-
Notifications
You must be signed in to change notification settings - Fork 67
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
Rust: modify sorted set command types to RESP3 #912
Conversation
f4fcc2b
to
8c491ac
Compare
dd8a46c
to
564c8a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please push your rounds as a separate commit instead of squashing.
Value::Array(array) => { | ||
let result: Result<Vec<Value>, _> = array | ||
.into_iter() | ||
.map(|element| match element { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need the match if you're calling convert_to_expected_type(element, Some(ExpectedReturnType::Double))
internally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am converting string values to double, the rest stays as it is.
Some(ExpectedReturnType::MapOfStringToDouble), | ||
); | ||
|
||
match result { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of match
ing on result, just call .unwrap()
(in tests)
fix this throughout
.into()); | ||
} | ||
let mut inner_iterator = inner_array.into_iter(); | ||
let inner_key = inner_iterator.next().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's preferable not to unwrap
in production code, only in tests. If you're keeping the unwrap because the check above ensures it is safe, add a comment explaining this.
) | ||
.into()); | ||
}; | ||
map.push((key, value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're not converting the values, just copying them as-is.
564c8a1
to
47f91b0
Compare
Oh sorry I missed that message. |
47f91b0
to
33863d8
Compare
.into()); | ||
} | ||
|
||
array[1] = match convert_to_expected_type( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array[1] = convert_to_expected_type( array[1].clone(),
Some(ExpectedReturnType::Double))?;
dbf4dd8
to
e8b325d
Compare
------------ Co-authored-by: Shoham Elias <shohame@amazon.com> Co-authored-by: Adan Wattad <adanwat@amazon.com>
e8b325d
to
6c18fbd
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.