Make decl_module not require a return type for functions (#1230)

If no return type is specified, `Result` is added and
`Ok(())` is returned by default.

Closes: #1182
This commit is contained in:
Bastian Köcher
2018-12-10 13:36:37 +01:00
committed by GitHub
parent 52ba9a5605
commit acf1b77bcd
17 changed files with 134 additions and 147 deletions
+3 -4
View File
@@ -173,12 +173,11 @@ decl_module! {
// calls to be executed - we don't need to care why. Because it's privileged, we can
// assume it's a one-off operation and substantial processing/storage/memory can be used
// without worrying about gameability or attack scenarios.
fn set_dummy(new_value: T::Balance) -> Result {
// If you not specify `Result` explicitly as return value, it will be added automatically
// for you and `Ok(())` will be returned.
fn set_dummy(new_value: T::Balance) {
// Put the new value into storage.
<Dummy<T>>::put(new_value);
// All good.
Ok(())
}
// The signature could also look like: `fn on_finalise()`