Skip to content

Commit 537ba90

Browse files
author
Shady Khalifa
committed
switch to stable rust.
1 parent 73f64f8 commit 537ba90

File tree

8 files changed

+42
-38
lines changed

8 files changed

+42
-38
lines changed

native/ffi/src/handler.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ pub async fn handle(
2323
.encode(&mut bytes)
2424
.expect("should never fails");
2525
return bytes;
26-
},
26+
}
2727
};
2828
let result = match body {
2929
RequestBody::SpaceById(args) => {
3030
space_by_id(client, args.space_id).await
31-
},
31+
}
3232
RequestBody::SpaceByHandle(args) => {
3333
space_by_handle(client, args.handle).await
34-
},
34+
}
3535
RequestBody::PostIdsBySpaceId(args) => {
3636
posts_ids_by_space_id(client, args.space_id).await
37-
},
37+
}
3838
RequestBody::PostById(args) => post_by_id(client, args.post_id).await,
3939
RequestBody::ReactionIdsByPostId(args) => {
4040
reactions_ids_by_post_id(client, args.post_id).await
41-
},
41+
}
4242
RequestBody::ReactionById(args) => {
4343
reaction_by_id(client, args.reaction_id).await
44-
},
44+
}
4545
RequestBody::ReplyIdsByPostId(args) => {
4646
reply_ids_by_post_id(client, args.post_id).await
47-
},
47+
}
4848
};
4949
let response = match result {
5050
Ok(body) => Response { body: Some(body) },
@@ -69,7 +69,7 @@ async fn space_by_id(
6969
space: Some(space.into()),
7070
});
7171
Ok(body)
72-
},
72+
}
7373
None => Err(Error {
7474
kind: error::Kind::NotFound.into(),
7575
msg: String::from("Space Not Found"),
@@ -92,7 +92,7 @@ async fn space_by_handle(
9292
};
9393
let body = ResponseBody::SpaceByHandle(SpaceByHandle { space });
9494
Ok(body)
95-
},
95+
}
9696
None => Err(Error {
9797
kind: error::Kind::NotFound.into(),
9898
msg: String::from("Space Not Found"),
@@ -112,7 +112,7 @@ async fn posts_ids_by_space_id(
112112
post_ids: ids,
113113
});
114114
Ok(body)
115-
},
115+
}
116116
None => Err(Error {
117117
kind: error::Kind::NotFound.into(),
118118
msg: String::from("Space Not Found"),
@@ -132,7 +132,7 @@ async fn post_by_id(
132132
post: Some(post.into()),
133133
});
134134
Ok(body)
135-
},
135+
}
136136
None => Err(Error {
137137
kind: error::Kind::NotFound.into(),
138138
msg: String::from("Post Not Found"),
@@ -152,7 +152,7 @@ async fn reactions_ids_by_post_id(
152152
reaction_ids: ids,
153153
});
154154
Ok(body)
155-
},
155+
}
156156
None => Err(Error {
157157
kind: error::Kind::NotFound.into(),
158158
msg: String::from("Post Not Found"),
@@ -172,7 +172,7 @@ async fn reaction_by_id(
172172
reaction: Some(reaction.into()),
173173
});
174174
Ok(body)
175-
},
175+
}
176176
None => Err(Error {
177177
kind: error::Kind::NotFound.into(),
178178
msg: String::from("Reaction Not Found"),
@@ -192,7 +192,7 @@ async fn reply_ids_by_post_id(
192192
reply_ids: ids,
193193
});
194194
Ok(body)
195-
},
195+
}
196196
None => Err(Error {
197197
kind: error::Kind::NotFound.into(),
198198
msg: String::from("Post Not Found"),

native/ffi/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub extern "C" fn subsocial_dispatch(port: i64, ptr: Box<SharedBuffer>) -> i32 {
6969
.expect("should never fails");
7070
isolate.post(bytes);
7171
return 0xbadc0de;
72-
},
72+
}
7373
};
7474
let client = match unsafe { CLIENT.get() } {
7575
Some(v) => v,
@@ -86,7 +86,7 @@ pub extern "C" fn subsocial_shutdown() -> i32 {
8686
Some(client) => {
8787
drop(client);
8888
1
89-
},
89+
}
9090
None => 0xdead,
9191
}
9292
}

native/ffi/src/shared_buffer.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ pub struct SharedBuffer {
99
}
1010

1111
impl Default for SharedBuffer {
12-
fn default() -> Self { Vec::new().into() }
12+
fn default() -> Self {
13+
Vec::new().into()
14+
}
1315
}
1416

1517
impl SharedBuffer {

native/ffi/src/transformer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl From<posts::PostExtension> for PostExtension {
4646
},
4747
posts::PostExtension::RegularPost => {
4848
unimplemented!("Should be None!")
49-
},
49+
}
5050
}
5151
}
5252
}
@@ -117,7 +117,7 @@ impl From<reactions::ReactionKind> for reaction::ReactionKind {
117117
reactions::ReactionKind::Upvote => reaction::ReactionKind::UpVote,
118118
reactions::ReactionKind::Downvote => {
119119
reaction::ReactionKind::DownVote
120-
},
120+
}
121121
}
122122
}
123123
}

native/sdk/src/pallet/traits.rs

+18-6
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ pub trait IsAccountBlocked<AccountId> {
5656
}
5757

5858
impl<AccountId> IsAccountBlocked<AccountId> for () {
59-
fn is_blocked_account(_account: AccountId, _scope: u64) -> bool { false }
59+
fn is_blocked_account(_account: AccountId, _scope: u64) -> bool {
60+
false
61+
}
6062

61-
fn is_allowed_account(_account: AccountId, _scope: u64) -> bool { true }
63+
fn is_allowed_account(_account: AccountId, _scope: u64) -> bool {
64+
true
65+
}
6266
}
6367

6468
pub trait IsSpaceBlocked {
@@ -73,9 +77,13 @@ pub trait IsPostBlocked<PostId> {
7377
}
7478

7579
impl<PostId> IsPostBlocked<PostId> for () {
76-
fn is_blocked_post(_post_id: PostId, _scope: SpaceId) -> bool { false }
80+
fn is_blocked_post(_post_id: PostId, _scope: SpaceId) -> bool {
81+
false
82+
}
7783

78-
fn is_allowed_post(_post_id: PostId, _scope: u64) -> bool { true }
84+
fn is_allowed_post(_post_id: PostId, _scope: u64) -> bool {
85+
true
86+
}
7987
}
8088

8189
pub trait IsContentBlocked {
@@ -84,7 +92,11 @@ pub trait IsContentBlocked {
8492
}
8593

8694
impl IsContentBlocked for () {
87-
fn is_blocked_content(_content: Content, _scope: u64) -> bool { false }
95+
fn is_blocked_content(_content: Content, _scope: u64) -> bool {
96+
false
97+
}
8898

89-
fn is_allowed_content(_content: Content, _scope: SpaceId) -> bool { true }
99+
fn is_allowed_content(_content: Content, _scope: SpaceId) -> bool {
100+
true
101+
}
90102
}

native/sdk/src/pallet/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl fmt::Display for Content {
4040
Raw(_) => write!(f, "<RAW_BYTES>"),
4141
IPFS(v) => {
4242
write!(f, "{}", String::from_utf8(v.clone()).unwrap())
43-
},
43+
}
4444
Hyper(_) => write!(f, "<Hyper>"),
4545
}
4646
}

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel = "nightly"
2+
channel = "stable"
33
components = ["rustfmt", "clippy"]
44
targets = [
55
"aarch64-linux-android",

rustfmt.toml

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
max_width = 80
22
tab_spaces = 4
3-
fn_single_line = true
4-
match_block_trailing_comma = true
5-
normalize_comments = true
6-
wrap_comments = true
7-
imports_granularity = "Module"
8-
reorder_impl_items = true
9-
use_field_init_shorthand = true
10-
use_try_shorthand = true
11-
normalize_doc_attributes = true
12-
report_fixme = "Always"
13-
edition = "2018"
3+

0 commit comments

Comments
 (0)