Skip to content

Commit a0080e4

Browse files
author
Fahad Zubair
committed
Use asValue instead of asRef. Do not use let _v if clippy gives a warning.
1 parent 2bbf46e commit a0080e4

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/CborParserGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class CborParserGenerator(
109109
"""
110110
let value = match decoder.datatype()? {
111111
#{SmithyCbor}::data::Type::Null => {
112-
let _v = decoder.null()?;
112+
decoder.null()?;
113113
None
114114
}
115115
_ => Some(#{DeserializeMember:W}?),
@@ -167,7 +167,7 @@ class CborParserGenerator(
167167
"""
168168
let value = match decoder.datatype()? {
169169
#{SmithyCbor}::data::Type::Null => {
170-
let _v = decoder.null()?;
170+
decoder.null()?;
171171
None
172172
}
173173
_ => Some(#{DeserializeValue:W}?),

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/CborSerializerGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ class CborSerializerGenerator(
402402
rust(
403403
"""
404404
encoder.array(
405-
(${context.valueExpression.asRef()}).len().try_into().expect("`usize` to `u64` conversion failed")
405+
(${context.valueExpression.asValue()}).len().try_into().expect("`usize` to `u64` conversion failed")
406406
);
407407
"""
408408
)
@@ -421,7 +421,7 @@ class CborSerializerGenerator(
421421
rust(
422422
"""
423423
encoder.map(
424-
(${context.valueExpression.asRef()}).len().try_into().expect("`usize` to `u64` conversion failed")
424+
(${context.valueExpression.asValue()}).len().try_into().expect("`usize` to `u64` conversion failed")
425425
);
426426
"""
427427
)

rust-runtime/aws-smithy-cbor/src/decode.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pub struct Decoder<'b> {
1717
decoder: minicbor::Decoder<'b>,
1818
}
1919

20+
/// When any of the decode methods are called they look for that particular data type at the current
21+
/// position. If the CBOR data tag does not match the type, a `DeserializeError` is returned.
2022
#[derive(Debug)]
2123
pub struct DeserializeError {
2224
#[allow(dead_code)]

0 commit comments

Comments
 (0)