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
+2 -4
View File
@@ -93,17 +93,15 @@ decl_module! {
/// Sets the session key of `_validator` to `_key`. This doesn't take effect until the next
/// session.
fn set_key(origin, key: T::SessionKey) -> Result {
fn set_key(origin, key: T::SessionKey) {
let who = ensure_signed(origin)?;
// set new value for next session
<NextKeyFor<T>>::insert(who, key);
Ok(())
}
/// Set a new session length. Won't kick in until the next session change (at current length).
fn set_length(new: <T::BlockNumber as HasCompact>::Type) -> Result {
fn set_length(new: <T::BlockNumber as HasCompact>::Type) {
<NextSessionLength<T>>::put(new.into());
Ok(())
}
/// Forces a new session.