difftreelog
Apply suggestions from code review
in: master
7 files changed
pallets/fungible/src/common.rsdiffbeforeafterboth364364365 /// Returns 10 tokens owners in no particular order.365 /// Returns 10 tokens owners in no particular order.366 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {366 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {367 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])367 <Pallet<T>>::token_owners(self.id, token).unwrap_or_default()368 }368 }369369370 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {370 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -629,7 +629,7 @@
.take(10)
.collect();
- if res.len() == 0 {
+ if res.is_empty() {
None
} else {
Some(res)
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -440,7 +440,7 @@
/// Returns 10 token in no particular order.
fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
- <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])
+ <Pallet<T>>::token_owners(self.id, token).unwrap_or_default()
}
fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -1150,7 +1150,7 @@
.take(10)
.collect();
- if res.len() == 0 {
+ if res.is_empty() {
None
} else {
Some(res)
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -81,6 +81,6 @@
fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>>;
fn effective_collection_limits(collection_id: CollectionId) -> Result<Option<CollectionLimits>>;
fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Result<Option<u128>>;
- fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec::<CrossAccountId>>;
+ fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec<CrossAccountId>>;
}
}
tests/src/refungible.test.tsdiffbeforeafterboth--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -100,7 +100,7 @@
// What to expect
// tslint:disable-next-line:no-unused-expression
expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);
- expect(owners.length == 10).to.be.true;
+ expect(owners.length).to.be.equal(10);
const eleven = privateKeyWrapper('11');
expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;
tests/src/rpc.test.tsdiffbeforeafterboth--- a/tests/src/rpc.test.ts
+++ b/tests/src/rpc.test.ts
@@ -23,7 +23,7 @@
});
});
- it('RPC method tokenOnewrs for fungible collection and token', async () => {
+ it('RPC method tokenOwners for fungible collection and token', async () => {
await usingApi(async (api, privateKeyWrapper) => {
const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
const facelessCrowd = Array.from(Array(7).keys()).map(i => normalizeAccountId(privateKeyWrapper(i.toString())));