Skip to content

Commit 49aab6e

Browse files
authored
Merge pull request #92 from ionut-arm/lint-travis
Fix lints and remove Travis build
2 parents ad03081 + cc099b2 commit 49aab6e

7 files changed

+39
-31
lines changed
File renamed without changes.

src/operations_protobuf/convert_list_authenticators.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,13 @@ mod test {
100100
#[test]
101101
fn proto_to_resp() {
102102
let mut proto: ResultProto = Default::default();
103-
let mut authenticator_info = AuthenticatorInfoProto::default();
104-
authenticator_info.description = String::from("authenticator description");
105-
authenticator_info.version_maj = 0;
106-
authenticator_info.version_min = 1;
107-
authenticator_info.version_rev = 0;
108-
authenticator_info.id = AuthType::Direct as u32;
103+
let authenticator_info = AuthenticatorInfoProto {
104+
description: String::from("authenticator description"),
105+
version_maj: 0,
106+
version_min: 1,
107+
version_rev: 0,
108+
id: AuthType::Direct as u32,
109+
};
109110
proto.authenticators.push(authenticator_info);
110111
let resp: Result = proto.try_into().unwrap();
111112

src/operations_protobuf/convert_list_keys.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ mod test {
106106
#[test]
107107
fn proto_to_resp() {
108108
let mut proto: ResultProto = Default::default();
109-
let mut key_info = KeyInfoProto::default();
110-
key_info.provider_id = ProviderID::MbedCrypto as u32;
111-
key_info.name = String::from("Some Key Name");
112109

113110
let key_attrs = Attributes {
114111
lifetime: Lifetime::Persistent,
@@ -136,7 +133,11 @@ mod test {
136133
};
137134

138135
let key_attrs_proto: KeyAttributesProto = key_attrs.try_into().unwrap();
139-
key_info.attributes = Some(key_attrs_proto);
136+
let key_info = KeyInfoProto {
137+
provider_id: ProviderID::MbedCrypto as u32,
138+
name: String::from("Some Key Name"),
139+
attributes: Some(key_attrs_proto),
140+
};
140141
proto.keys.push(key_info);
141142

142143
let resp: Result = proto.try_into().unwrap();

src/operations_protobuf/convert_list_providers.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,15 @@ mod test {
112112
#[test]
113113
fn proto_to_resp() {
114114
let mut proto: ResultProto = Default::default();
115-
let mut provider_info = ProviderInfoProto::default();
116-
provider_info.uuid = String::from("9840cd61-9367-4010-bc24-f5b98a6174d1");
117-
provider_info.description = String::from("provider description");
118-
provider_info.vendor = String::from("Arm");
119-
provider_info.version_maj = 0;
120-
provider_info.version_min = 1;
121-
provider_info.version_rev = 0;
122-
provider_info.id = 1;
115+
let provider_info = ProviderInfoProto {
116+
uuid: String::from("9840cd61-9367-4010-bc24-f5b98a6174d1"),
117+
description: String::from("provider description"),
118+
vendor: String::from("Arm"),
119+
version_maj: 0,
120+
version_min: 1,
121+
version_rev: 0,
122+
id: 1,
123+
};
123124
proto.providers.push(provider_info);
124125
let resp: Result = proto.try_into().unwrap();
125126

src/operations_protobuf/convert_ping.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ impl TryFrom<Result> for ResultProto {
2525
type Error = ResponseStatus;
2626

2727
fn try_from(result: Result) -> std::result::Result<Self, Self::Error> {
28-
let mut proto_response: ResultProto = Default::default();
29-
proto_response.wire_protocol_version_maj = u32::from(result.wire_protocol_version_maj);
30-
proto_response.wire_protocol_version_min = u32::from(result.wire_protocol_version_min);
28+
let proto_response = ResultProto {
29+
wire_protocol_version_maj: u32::from(result.wire_protocol_version_maj),
30+
wire_protocol_version_min: u32::from(result.wire_protocol_version_min),
31+
};
3132

3233
Ok(proto_response)
3334
}
@@ -58,9 +59,10 @@ mod test {
5859

5960
#[test]
6061
fn proto_to_resp() {
61-
let mut proto: ResultProto = Default::default();
62-
proto.wire_protocol_version_maj = 1;
63-
proto.wire_protocol_version_min = 1;
62+
let proto = ResultProto {
63+
wire_protocol_version_maj: 1,
64+
wire_protocol_version_min: 1,
65+
};
6466
let resp: Result = proto.try_into().unwrap();
6567

6668
assert!(resp.wire_protocol_version_maj == 1);

src/operations_protobuf/convert_psa_generate_key.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ impl TryFrom<Operation> for OperationProto {
2727
type Error = ResponseStatus;
2828

2929
fn try_from(op: Operation) -> std::result::Result<Self, Self::Error> {
30-
let mut proto: OperationProto = Default::default();
31-
proto.key_name = op.key_name;
32-
proto.attributes = Some(op.attributes.try_into()?);
30+
let proto = OperationProto {
31+
key_name: op.key_name,
32+
attributes: Some(op.attributes.try_into()?),
33+
};
3334

3435
Ok(proto)
3536
}

src/operations_protobuf/convert_psa_generate_random.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ impl TryFrom<Operation> for OperationProto {
2121
type Error = ResponseStatus;
2222

2323
fn try_from(op: Operation) -> std::result::Result<Self, Self::Error> {
24-
let mut proto: OperationProto = Default::default();
25-
proto.size = op.size.try_into()?;
24+
let proto = OperationProto {
25+
size: op.size.try_into()?,
26+
};
2627
Ok(proto)
2728
}
2829
}
@@ -60,8 +61,9 @@ mod test {
6061

6162
#[test]
6263
fn proto_to_resp() {
63-
let mut proto: ResultProto = Default::default();
64-
proto.random_bytes = vec![0xDE, 0xAD, 0xBE, 0xEF];
64+
let proto = ResultProto {
65+
random_bytes: vec![0xDE, 0xAD, 0xBE, 0xEF],
66+
};
6567

6668
let resp: Result = proto.try_into().unwrap();
6769

0 commit comments

Comments
 (0)