Skip to content

Commit 4c6c460

Browse files
committed
chore: fix fmt with new style_edition
fmt keeps changing all the time. Now they introduced new "editions" feature, which by default does a lot of changes to the codebase by mingling with alphabetical sorting of all imports, doing them in case-insentive way. This PR allows to avoid that dramatic changes
1 parent 885ca71 commit 4c6c460

File tree

10 files changed

+90
-54
lines changed

10 files changed

+90
-54
lines changed

.rustfmt.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
edition = "2021"
2-
version = "Two"
2+
style_edition = "2021"
33

44
max_width = 100
55
array_width = 100

src/containers/consignment.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -557,23 +557,23 @@ Check-SHA256: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
557557
// Wrong type
558558
// TODO: Uncomment once ASCII headers get checked
559559
/*assert!(matches!(
560-
Transfer::from_str(
561-
r#"-----BEGIN RGB CONSIGNMENT-----
562-
Id: rgb:csg:9jMKgkmP-alPghZC-bu65ctP-GT5tKgM-cAbaTLT-rhu8xQo#urban-athena-adam
563-
Version: 2
564-
Type: contract
565-
Contract: rgb:T24t0N1D-eiInTgb-BXlrrXz-$7OgV6n-WJWHPUD-BWNuqZw
566-
Schema: rgb:sch:CyqM42yAdM1moWyNZPQedAYt73BM$k9z$dKLUXY1voA#cello-global-deluxe
567-
Check-SHA256: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
568-
569-
0s#O3000000000000000000000000000000000000000000000000000000D0CRI`I$>^aZh38Qb#nj!
570-
0000000000000000000000d59ZDjxe00000000dDb8~4rVQz13d2MfXa{vGU00000000000000000000
571-
0000000000000
572-
573-
-----END RGB CONSIGNMENT-----"#
574-
),
575-
Err(ConsignmentParseError::Type)
576-
));*/
560+
Transfer::from_str(
561+
r#"-----BEGIN RGB CONSIGNMENT-----
562+
Id: rgb:csg:9jMKgkmP-alPghZC-bu65ctP-GT5tKgM-cAbaTLT-rhu8xQo#urban-athena-adam
563+
Version: 2
564+
Type: contract
565+
Contract: rgb:T24t0N1D-eiInTgb-BXlrrXz-$7OgV6n-WJWHPUD-BWNuqZw
566+
Schema: rgb:sch:CyqM42yAdM1moWyNZPQedAYt73BM$k9z$dKLUXY1voA#cello-global-deluxe
567+
Check-SHA256: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
568+
569+
0s#O3000000000000000000000000000000000000000000000000000000D0CRI`I$>^aZh38Qb#nj!
570+
0000000000000000000000d59ZDjxe00000000dDb8~4rVQz13d2MfXa{vGU00000000000000000000
571+
0000000000000
572+
573+
-----END RGB CONSIGNMENT-----"#
574+
),
575+
Err(ConsignmentParseError::Type)
576+
));*/
577577
assert!(matches!(
578578
Transfer::from_str(include_str!("../../asset/armored_contract.default")),
579579
Err(ConsignmentParseError::Type)

src/containers/kit.rs

+12-18
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,8 @@ mod test {
289289

290290
#[test]
291291
fn error_kit_strs() {
292-
assert!(
293-
Kit::from_str(
294-
r#"-----BEGIN RGB KIT-----
292+
assert!(Kit::from_str(
293+
r#"-----BEGIN RGB KIT-----
295294
Id: rgb:kit:e1jW6Rgc-2$JzXDg-XmR8XRJ-v!q$Dzf-yImkPjD-t8EjfvI
296295
Version: 2
297296
Type-System: sts:8Vb$sM1F-5MsQc20-HEixf55-gJR37FM-0zRKfpY-SwIp35w#design-farmer-camel
@@ -300,14 +299,12 @@ Check-SHA256: 5563cc1568e244183804e0db3cec6ff9bf577f4a403924096177bf4a586160da
300299
0ssI2000000000
301300
302301
-----END RGB KIT-----"#
303-
)
304-
.is_ok()
305-
);
302+
)
303+
.is_ok());
306304

307305
// Wrong Id
308-
assert!(
309-
Kit::from_str(
310-
r#"-----BEGIN RGB KIT-----
306+
assert!(Kit::from_str(
307+
r#"-----BEGIN RGB KIT-----
311308
Id: rgb:kit:11111111-2222222-XmR8XRJ-v!q$Dzf-yImkPjD-t8EjfvI
312309
Version: 2
313310
Type-System: sts:8Vb$sM1F-5MsQc20-HEixf55-gJR37FM-0zRKfpY-SwIp35w#design-farmer-camel
@@ -316,14 +313,12 @@ Check-SHA256: 5563cc1568e244183804e0db3cec6ff9bf577f4a403924096177bf4a586160da
316313
0ssI2000000000
317314
318315
-----END RGB KIT-----"#
319-
)
320-
.is_err()
321-
);
316+
)
317+
.is_err());
322318

323319
// wrong checksum
324-
assert!(
325-
Kit::from_str(
326-
r#"-----BEGIN RGB KIT-----
320+
assert!(Kit::from_str(
321+
r#"-----BEGIN RGB KIT-----
327322
Id: rgb:kit:e1jW6Rgc-2$JzXDg-XmR8XRJ-v!q$Dzf-yImkPjD-t8EjfvI
328323
Version: 2
329324
Type-System: sts:8Vb$sM1F-5MsQc20-HEixf55-gJR37FM-0zRKfpY-SwIp35w#design-farmer-camel
@@ -332,8 +327,7 @@ Check-SHA256: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
332327
0ssI2000000000
333328
334329
-----END RGB KIT-----"#
335-
)
336-
.is_err()
337-
);
330+
)
331+
.is_err());
338332
}
339333
}

src/containers/partials.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ impl BitOrAssign<CloseMethodSet> for Option<CloseMethodSet> {
8989

9090
impl<T: Into<CloseMethodSet>> BitOr<T> for CloseMethodSet {
9191
type Output = Self;
92-
fn bitor(self, rhs: T) -> Self::Output { if self == rhs.into() { self } else { Self::Both } }
92+
fn bitor(self, rhs: T) -> Self::Output {
93+
if self == rhs.into() {
94+
self
95+
} else {
96+
Self::Both
97+
}
98+
}
9399
}
94100

95101
impl<T: Into<CloseMethodSet>> BitOrAssign<T> for CloseMethodSet {

src/interface/iface.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,11 @@ pub enum OwnedIface {
246246

247247
impl OwnedIface {
248248
pub fn sem_id(&self) -> Option<SemId> {
249-
if let Self::Data(id) = self { Some(*id) } else { None }
249+
if let Self::Data(id) = self {
250+
Some(*id)
251+
} else {
252+
None
253+
}
250254
}
251255
}
252256

@@ -609,7 +613,11 @@ impl Iface {
609613
}
610614
}
611615

612-
if errors.is_empty() { Ok(()) } else { Err(errors) }
616+
if errors.is_empty() {
617+
Ok(())
618+
} else {
619+
Err(errors)
620+
}
613621
}
614622

615623
// TODO: Implement checking interface inheritance.

src/interface/iimpl.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ impl IfaceImpl {
554554
}
555555
}
556556

557-
if errors.is_empty() { Ok(()) } else { Err(errors) }
557+
if errors.is_empty() {
558+
Ok(())
559+
} else {
560+
Err(errors)
561+
}
558562
}
559563
}

src/interface/inheritance.rs

+30-6
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ impl CheckInheritance for Schema {
137137
}
138138
}
139139

140-
if status.is_empty() { Ok(()) } else { Err(status) }
140+
if status.is_empty() {
141+
Ok(())
142+
} else {
143+
Err(status)
144+
}
141145
}
142146
}
143147

@@ -208,7 +212,11 @@ where T: OpSchema
208212
}
209213
}
210214

211-
if status.is_empty() { Ok(()) } else { Err(status) }
215+
if status.is_empty() {
216+
Ok(())
217+
} else {
218+
Err(status)
219+
}
212220
}
213221
}
214222

@@ -503,7 +511,11 @@ impl Iface {
503511
.map_err(|_| errors.push(ExtensionError::InheritanceOverflow))
504512
.ok();
505513

506-
if errors.is_empty() { Ok(self) } else { Err(errors) }
514+
if errors.is_empty() {
515+
Ok(self)
516+
} else {
517+
Err(errors)
518+
}
507519
}
508520
}
509521

@@ -575,7 +587,11 @@ impl GenesisIface {
575587
check_presence(&mut self.valencies, ext.valencies, op.clone(), "valency", &mut errors);
576588
check_presence(&mut self.errors, ext.errors, op.clone(), "error", &mut errors);
577589

578-
if errors.is_empty() { Ok(self) } else { Err(errors) }
590+
if errors.is_empty() {
591+
Ok(self)
592+
} else {
593+
Err(errors)
594+
}
579595
}
580596
}
581597

@@ -612,7 +628,11 @@ impl TransitionIface {
612628
}
613629
}
614630

615-
if errors.is_empty() { Ok(self) } else { Err(errors) }
631+
if errors.is_empty() {
632+
Ok(self)
633+
} else {
634+
Err(errors)
635+
}
616636
}
617637
}
618638

@@ -649,7 +669,11 @@ impl ExtensionIface {
649669
}
650670
}
651671

652-
if errors.is_empty() { Ok(self) } else { Err(errors) }
672+
if errors.is_empty() {
673+
Ok(self)
674+
} else {
675+
Err(errors)
676+
}
653677
}
654678
}
655679

src/persistence/stash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ pub trait StashWriteProvider: StoreTransaction<TransactionErr = Self::Error> {
774774
fn replace_bundle(&mut self, bundle: TransitionBundle) -> Result<bool, Self::Error>;
775775
fn replace_witness(&mut self, witness: SealWitness) -> Result<bool, Self::Error>;
776776
fn replace_attachment(&mut self, id: AttachId, attach: MediumBlob)
777-
-> Result<bool, Self::Error>;
777+
-> Result<bool, Self::Error>;
778778

779779
fn replace_lib(&mut self, lib: Lib) -> Result<bool, Self::Error>;
780780
fn consume_types(&mut self, types: TypeSystem) -> Result<(), Self::Error>;

src/persistence/stock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ impl<S: StashProvider, H: StateProvider, P: IndexProvider> Stock<S, H, P> {
510510
&'a self,
511511
) -> Result<
512512
impl Iterator<
513-
Item = <C::Wrapper<H::ContractRead<'_>> as IfaceWrapper<H::ContractRead<'_>>>::Info,
514-
> + 'a,
513+
Item = <C::Wrapper<H::ContractRead<'_>> as IfaceWrapper<H::ContractRead<'_>>>::Info,
514+
> + 'a,
515515
StockError<S, H, P>,
516516
> {
517517
Ok(self.stash.geneses_by::<C>()?.filter_map(|genesis| {

src/stl/stl.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222
pub use bp::bc::stl::bp_tx_stl;
2323
pub use bp::stl::bp_core_stl;
2424
#[allow(unused_imports)]
25-
pub use commit_verify::stl::{LIB_ID_COMMIT_VERIFY, commit_verify_stl};
25+
pub use commit_verify::stl::{commit_verify_stl, LIB_ID_COMMIT_VERIFY};
2626
use invoice::{Allocation, Amount};
27-
pub use rgb::stl::{LIB_ID_RGB_COMMIT, LIB_ID_RGB_LOGIC, aluvm_stl, rgb_commit_stl, rgb_logic_stl};
27+
pub use rgb::stl::{aluvm_stl, rgb_commit_stl, rgb_logic_stl, LIB_ID_RGB_COMMIT, LIB_ID_RGB_LOGIC};
2828
use strict_types::stl::{std_stl, strict_types_stl};
2929
use strict_types::typesys::SystemBuilder;
3030
use strict_types::{CompileError, LibBuilder, SemId, SymbolicSys, TypeLib, TypeSystem};
3131

3232
use super::{
33-
AssetSpec, BurnMeta, ContractSpec, ContractTerms, Error, IssueMeta, LIB_NAME_RGB_CONTRACT,
34-
LIB_NAME_RGB_STORAGE, MediaType,
33+
AssetSpec, BurnMeta, ContractSpec, ContractTerms, Error, IssueMeta, MediaType,
34+
LIB_NAME_RGB_CONTRACT, LIB_NAME_RGB_STORAGE,
3535
};
36-
use crate::LIB_NAME_RGB_STD;
3736
use crate::containers::{Contract, Kit, Transfer};
3837
use crate::persistence::{MemIndex, MemStash, MemState};
3938
use crate::stl::ProofOfReserves;
39+
use crate::LIB_NAME_RGB_STD;
4040

4141
/// Strict types id for the library providing standard data types which may be
4242
/// used in RGB smart contracts.

0 commit comments

Comments
 (0)