Skip to content

Commit c746262

Browse files
Address feedback
1 parent e1a6b8c commit c746262

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

rs/nns/governance/src/proposals/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ impl ValidProposalAction {
175175
}
176176
}
177177

178-
/// Converts the proposal action to a self describing representation of itself.
178+
/// Converts the proposal action to a self describing representation of itself. Note that it is
179+
/// async because we need to call `ic0.canister_metadata` to get the candid file of an external
180+
/// canister.
179181
pub async fn to_self_describing(
180182
&self,
181183
_env: Arc<dyn Environment>,

rs/nns/governance/src/proposals/self_describing.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ pub trait LocallyDescribableProposalAction {
2525

2626
impl LocallyDescribableProposalAction for Motion {
2727
const TYPE_NAME: &'static str = "Motion";
28+
2829
const TYPE_DESCRIPTION: &'static str = "A motion is a text that can be adopted or rejected. \
2930
No code is executed when a motion is adopted. An adopted motion should guide the future \
3031
strategy of the Internet Computer ecosystem.";
3132

3233
fn to_value(&self) -> Value {
3334
ValueBuilder::new()
34-
.add_string_field("motion_text".to_string(), self.motion_text.clone())
35+
.add_string_field("motion_text", self.motion_text.clone())
3536
.build()
3637
}
3738
}
@@ -48,11 +49,11 @@ impl ValueBuilder {
4849
}
4950
}
5051

51-
pub fn add_string_field(mut self, key: String, value: String) -> Self {
52+
pub fn add_string_field(mut self, key: impl ToString, value: String) -> Self {
5253
self.fields.insert(
53-
key,
54+
key.to_string(),
5455
Value {
55-
value: Some(Text(value)),
56+
value: Some(Text(value.to_string())),
5657
},
5758
);
5859
self

rs/nns/governance/src/proposals/self_describing_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use super::*;
33
use ic_nns_governance_api::Value as ApiValue;
44
use maplit::hashmap;
55

6+
#[track_caller]
67
fn assert_self_describing_value_is(
78
action: impl LocallyDescribableProposalAction,
89
expected: ApiValue,

0 commit comments

Comments
 (0)