From 921b588793930579a3e8f46199bb734d97bf9339 Mon Sep 17 00:00:00 2001
From: Robert-M-Lucas <100799838+Robert-M-Lucas@users.noreply.github.com>
Date: Fri, 9 Aug 2024 15:26:36 +0100
Subject: [PATCH] Refactoring
---
.idea/workspace.xml | 46 +--
build/out.asm | 414 +++++++++++------------
build/out.o | Bin 4688 -> 4688 bytes
build/out.out | Bin 18224 -> 18224 bytes
src/root/errors/mod.rs | 4 +-
src/root/name_resolver/name_resolvers.rs | 8 +-
src/root/parser/location.rs | 2 +-
src/root/parser/parse.rs | 6 +-
src/root/parser/parse_blocks.rs | 2 +-
src/root/parser/path_storage.rs | 2 +-
src/root/shared/common.rs | 4 +-
11 files changed, 244 insertions(+), 244 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index dbf0992..40b73ec 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,10 +7,11 @@
-
-
-
-
+
+
+
+
+
@@ -64,12 +65,12 @@
- {
+ "selectedUrlAndAccountId": {
+ "url": "https://github.com/Robert-M-Lucas/whython-8.git",
+ "accountId": "dcb8df19-0b39-47e1-9073-4a54f7034be8"
}
-}]]>
+}
@@ -276,15 +277,10 @@
-
-
-
-
- 1718888868217
-
-
-
- 1718888868217
+
+
+
+
@@ -670,7 +666,15 @@
1723053543861
-
+
+
+ 1723054195988
+
+
+
+ 1723054195988
+
+
@@ -727,7 +731,6 @@
-
@@ -752,7 +755,8 @@
-
+
+
diff --git a/build/out.asm b/build/out.asm
index 8a2000f..a0801fe 100644
--- a/build/out.asm
+++ b/build/out.asm
@@ -120,68 +120,100 @@ main:
ret
-_19:
+_10:
+ push rbp
+ mov rbp, rsp
+ mov qword [rbp+16], 0
+ leave
+ ret
+
+
+_11:
push rbp
mov rbp, rsp
mov rax, [rbp+16]
add rax, 0x0000000000000000
- mov qword [rbp-16], rax
- mov rdx, qword [rbp-16]
- mov rax, qword [rdx+0]
- mov qword [rbp-8], rax
- mov rdi, __8_fstr
- mov rsi, [rbp-8]
- mov al, 0
- sub rsp, 16
- extern printf
- call printf
- add rsp, 16
- mov rax, [rbp+16]
- add rax, 0x0000000000000008
- mov qword [rbp-34], rax
- mov rdx, qword [rbp-34]
+ mov qword [rbp-17], rax
+ mov rdx, qword [rbp-17]
mov rax, qword [rdx+0]
- mov qword [rbp-26], rax
- mov rax, qword [rbp-26]
+ mov qword [rbp-9], rax
+ mov rax, qword [rbp-9]
cmp rax, 0
- jz __36_6
- mov byte [rbp-18], 0
- jmp __36_7
- __36_6:
- mov byte [rbp-18], 1
- __36_7:
- mov al, byte [rbp-18]
- cmp al, 0
- jz __23_8
- mov byte [rbp-17], 0
- jmp __23_9
- __23_8:
- mov byte [rbp-17], 1
- __23_9:
- cmp byte [rbp-17], 0
- jz _19_10
+ jz __36_16
+ mov byte [rbp-1], 0
+ jmp __36_17
+ __36_16:
+ mov byte [rbp-1], 1
+ __36_17:
+ cmp byte [rbp-1], 0
+ jz _11_19
mov rax, [rbp+16]
- add rax, 0x0000000000000008
- mov qword [rbp-42], rax
- mov rdx, qword [rbp-42]
+ add rax, 0x0000000000000000
+ mov qword [rbp-25], rax
+ mov rax, qword [rbp+24]
+ mov qword [rbp-41], rax
+ mov rax, qword [rbp-41]
+ mov qword [rbp-57], rax
+ sub rsp, 0x0000000000000039
+ call _15
+ add rsp, 0x0000000000000039
+ mov rax, qword [rbp-49]
+ mov qword [rbp-33], rax
+ mov rdx, qword [rbp-25]
+ mov rax, qword [rbp-33]
+ mov qword [rdx+0], rax
+ jmp _11_18
+ _11_19:
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-25], rax
+ mov rdx, qword [rbp-25]
mov rax, qword [rdx+0]
- mov qword [rbp-50], rax
- mov rax, qword [rbp-50]
- mov qword [rbp-58], rax
- sub rsp, 0x000000000000003a
- call _19
- add rsp, 0x000000000000003a
- _19_11:
- _19_10:
+ mov qword [rbp-33], rax
+ mov rax, qword [rbp+24]
+ mov qword [rbp-41], rax
+ mov rax, qword [rbp-41]
+ mov qword [rbp-65], rax
+ mov rax, qword [rbp-33]
+ mov qword [rbp-73], rax
+ sub rsp, 0x0000000000000049
+ call _16
+ add rsp, 0x0000000000000049
+ _11_20:
+ _11_18:
leave
ret
-_18:
+_12:
push rbp
mov rbp, rsp
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
+ mov qword [rbp-8], rax
+ mov rdx, qword [rbp-8]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-16], rax
+ mov rax, qword [rbp+24]
+ mov qword [rbp-24], rax
+ mov rax, qword [rbp-24]
+ mov qword [rbp-48], rax
+ mov rax, qword [rbp-16]
+ mov qword [rbp-56], rax
+ sub rsp, 0x0000000000000038
+ call _17
+ add rsp, 0x0000000000000038
+ mov rax, qword [rbp-40]
+ mov qword [rbp+32], rax
+ leave
+ ret
+
+
+_13:
+ push rbp
+ mov rbp, rsp
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
mov qword [rbp-17], rax
mov rdx, qword [rbp-17]
mov rax, qword [rdx+0]
@@ -194,16 +226,16 @@ _18:
mov qword [rbp-9], rax
mov rax, qword [rbp-9]
cmp rax, 0
- jz __36_30
+ jz __36_26
mov byte [rbp-1], 0
- jmp __36_31
- __36_30:
+ jmp __36_27
+ __36_26:
mov byte [rbp-1], 1
- __36_31:
+ __36_27:
cmp byte [rbp-1], 0
- jz _18_32
+ jz _13_28
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-49], rax
mov rdx, qword [rbp-49]
mov rax, qword [rdx+0]
@@ -215,7 +247,7 @@ _18:
mov rax, qword [rdx+0]
mov qword [rbp-41], rax
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-81], rax
mov rdx, qword [rbp-81]
mov rax, qword [rdx+0]
@@ -226,7 +258,7 @@ _18:
call free
add rsp, 81
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-89], rax
mov qword [rbp-97], 0
mov rdx, qword [rbp-89]
@@ -236,10 +268,10 @@ _18:
mov qword [rbp+24], rax
leave
ret
- _18_33:
- _18_32:
+ _13_29:
+ _13_28:
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-41], rax
mov rdx, qword [rbp-41]
mov rax, qword [rdx+0]
@@ -255,6 +287,50 @@ _18:
ret
+_14:
+ push rbp
+ mov rbp, rsp
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-18], rax
+ mov rdx, qword [rbp-18]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-10], rax
+ mov rax, qword [rbp-10]
+ cmp rax, 0
+ jz __36_4
+ mov byte [rbp-2], 0
+ jmp __36_5
+ __36_4:
+ mov byte [rbp-2], 1
+ __36_5:
+ mov al, byte [rbp-2]
+ cmp al, 0
+ jz __23_6
+ mov byte [rbp-1], 0
+ jmp __23_7
+ __23_6:
+ mov byte [rbp-1], 1
+ __23_7:
+ cmp byte [rbp-1], 0
+ jz _14_8
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-26], rax
+ mov rdx, qword [rbp-26]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-34], rax
+ mov rax, qword [rbp-34]
+ mov qword [rbp-42], rax
+ sub rsp, 0x000000000000002a
+ call _19
+ add rsp, 0x000000000000002a
+ _14_9:
+ _14_8:
+
+leave
+ret
+
_15:
push rbp
mov rbp, rsp
@@ -278,87 +354,6 @@ _15:
ret
-_12:
- push rbp
- mov rbp, rsp
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-8], rax
- mov rdx, qword [rbp-8]
- mov rax, qword [rdx+0]
- mov qword [rbp-16], rax
- mov rax, qword [rbp+24]
- mov qword [rbp-24], rax
- mov rax, qword [rbp-24]
- mov qword [rbp-48], rax
- mov rax, qword [rbp-16]
- mov qword [rbp-56], rax
- sub rsp, 0x0000000000000038
- call _17
- add rsp, 0x0000000000000038
- mov rax, qword [rbp-40]
- mov qword [rbp+32], rax
- leave
- ret
-
-
-_11:
- push rbp
- mov rbp, rsp
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-17], rax
- mov rdx, qword [rbp-17]
- mov rax, qword [rdx+0]
- mov qword [rbp-9], rax
- mov rax, qword [rbp-9]
- cmp rax, 0
- jz __36_16
- mov byte [rbp-1], 0
- jmp __36_17
- __36_16:
- mov byte [rbp-1], 1
- __36_17:
- cmp byte [rbp-1], 0
- jz _11_19
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-25], rax
- mov rax, qword [rbp+24]
- mov qword [rbp-41], rax
- mov rax, qword [rbp-41]
- mov qword [rbp-57], rax
- sub rsp, 0x0000000000000039
- call _15
- add rsp, 0x0000000000000039
- mov rax, qword [rbp-49]
- mov qword [rbp-33], rax
- mov rdx, qword [rbp-25]
- mov rax, qword [rbp-33]
- mov qword [rdx+0], rax
- jmp _11_18
- _11_19:
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-25], rax
- mov rdx, qword [rbp-25]
- mov rax, qword [rdx+0]
- mov qword [rbp-33], rax
- mov rax, qword [rbp+24]
- mov qword [rbp-41], rax
- mov rax, qword [rbp-41]
- mov qword [rbp-65], rax
- mov rax, qword [rbp-33]
- mov qword [rbp-73], rax
- sub rsp, 0x0000000000000049
- call _16
- add rsp, 0x0000000000000049
- _11_20:
- _11_18:
-
-leave
-ret
-
_16:
push rbp
mov rbp, rsp
@@ -424,14 +419,14 @@ _17:
mov qword [rbp-17], 0
mov rax, qword [rbp-9]
cmp rax, qword [rbp-17]
- jz __16_26
+ jz __16_0
mov byte [rbp-1], 0
- jmp __16_27
- __16_26:
+ jmp __16_1
+ __16_0:
mov byte [rbp-1], 1
- __16_27:
+ __16_1:
cmp byte [rbp-1], 0
- jz _17_28
+ jz _17_2
mov rax, [rbp+16]
add rax, 0x0000000000000000
mov qword [rbp-25], rax
@@ -440,8 +435,8 @@ _17:
mov qword [rbp+32], rax
leave
ret
- _17_29:
- _17_28:
+ _17_3:
+ _17_2:
mov rax, [rbp+16]
add rax, 0x0000000000000008
mov qword [rbp-25], rax
@@ -467,55 +462,11 @@ _17:
ret
-_14:
- push rbp
- mov rbp, rsp
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-18], rax
- mov rdx, qword [rbp-18]
- mov rax, qword [rdx+0]
- mov qword [rbp-10], rax
- mov rax, qword [rbp-10]
- cmp rax, 0
- jz __36_0
- mov byte [rbp-2], 0
- jmp __36_1
- __36_0:
- mov byte [rbp-2], 1
- __36_1:
- mov al, byte [rbp-2]
- cmp al, 0
- jz __23_2
- mov byte [rbp-1], 0
- jmp __23_3
- __23_2:
- mov byte [rbp-1], 1
- __23_3:
- cmp byte [rbp-1], 0
- jz _14_4
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-26], rax
- mov rdx, qword [rbp-26]
- mov rax, qword [rdx+0]
- mov qword [rbp-34], rax
- mov rax, qword [rbp-34]
- mov qword [rbp-42], rax
- sub rsp, 0x000000000000002a
- call _19
- add rsp, 0x000000000000002a
- _14_5:
- _14_4:
-
-leave
-ret
-
-_13:
+_18:
push rbp
mov rbp, rsp
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-17], rax
mov rdx, qword [rbp-17]
mov rax, qword [rdx+0]
@@ -528,16 +479,16 @@ _13:
mov qword [rbp-9], rax
mov rax, qword [rbp-9]
cmp rax, 0
- jz __36_12
+ jz __36_30
mov byte [rbp-1], 0
- jmp __36_13
- __36_12:
+ jmp __36_31
+ __36_30:
mov byte [rbp-1], 1
- __36_13:
+ __36_31:
cmp byte [rbp-1], 0
- jz _13_14
+ jz _18_32
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-49], rax
mov rdx, qword [rbp-49]
mov rax, qword [rdx+0]
@@ -549,7 +500,7 @@ _13:
mov rax, qword [rdx+0]
mov qword [rbp-41], rax
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-81], rax
mov rdx, qword [rbp-81]
mov rax, qword [rdx+0]
@@ -560,7 +511,7 @@ _13:
call free
add rsp, 81
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-89], rax
mov qword [rbp-97], 0
mov rdx, qword [rbp-89]
@@ -570,10 +521,10 @@ _13:
mov qword [rbp+24], rax
leave
ret
- _13_15:
- _13_14:
+ _18_33:
+ _18_32:
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-41], rax
mov rdx, qword [rbp-41]
mov rax, qword [rdx+0]
@@ -589,13 +540,62 @@ _13:
ret
-_10:
+_19:
push rbp
mov rbp, rsp
- mov qword [rbp+16], 0
- leave
- ret
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-16], rax
+ mov rdx, qword [rbp-16]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-8], rax
+ mov rdi, __8_fstr
+ mov rsi, [rbp-8]
+ mov al, 0
+ sub rsp, 16
+ extern printf
+ call printf
+ add rsp, 16
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000008
+ mov qword [rbp-34], rax
+ mov rdx, qword [rbp-34]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-26], rax
+ mov rax, qword [rbp-26]
+ cmp rax, 0
+ jz __36_10
+ mov byte [rbp-18], 0
+ jmp __36_11
+ __36_10:
+ mov byte [rbp-18], 1
+ __36_11:
+ mov al, byte [rbp-18]
+ cmp al, 0
+ jz __23_12
+ mov byte [rbp-17], 0
+ jmp __23_13
+ __23_12:
+ mov byte [rbp-17], 1
+ __23_13:
+ cmp byte [rbp-17], 0
+ jz _19_14
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000008
+ mov qword [rbp-42], rax
+ mov rdx, qword [rbp-42]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-50], rax
+ mov rax, qword [rbp-50]
+ mov qword [rbp-58], rax
+ sub rsp, 0x000000000000003a
+ call _19
+ add rsp, 0x000000000000003a
+ _19_15:
+ _19_14:
+leave
+ret
section .data_readonly
__42_fstr db `\n`,0
diff --git a/build/out.o b/build/out.o
index 3da623cba3f8140a8b61e9f0297468f90310e336..03258740e0763071c2f4d20097444117535c1209 100644
GIT binary patch
delta 1505
zcmZ{kO-NKx6vywqGtNhj&Scb6D+)D)KFl|7oEgOe31N(kgcj{?GL5vDkThr!G(xn9
z0;@wri%|LkTSOq#B5GB*iI|E^5Tt_Iw30AdWOmMbXJ+z}7vA~!{r~6P$K`R0Eyb3{
zVWs*NRI8+FR&YSIsUH$XRYEJCbNO*>6hk||nrr=C(OyGiW
zcnj!Y6BGlD{!I$OL~uLQ2KR&_*kmre?1N08D{{_j(wWP>b8s!R5gNmvVw*kKgK#Eu
zska_(gz}+D5AFmRI0`jYQG9u~(ks)qgH;my70CK0pmE)7;UpUWUCnMI1sHr6^P2{D
zn9m!$i@D`H~2B;QwGm5Z}Yna2i!mZUqOgb<|kGS
z2yvGAxWUge2ZLW^K56hP#0x@-dxii!Fl+EzYw!u?bB6yR^KDgbQ4WuoA4Fa`e}qq1
zIBX2OV1C`;ub96v`0F+Jd*;Q8Kj5N|u)fABEU^5mBD>@(bIUWk9fj{}@I~gQ4gV7J
zX@f6&T#2W!SY!2d2i?9LB9cleOum8nh~c-GzlDKXYw&}iwzB%g;Cq>WGkA)5eW?6F
zZn3|_;dAY$uRiBeZssI-ca55@o90@w!>7_KLgeP1pkd0TVg!
zeWcjzu+c%A*{Hdhtev!(o9M$5aXmD8W(2FWSKvXwd~8WBgRHX}e)8{67f}a3zgN6f
d4R)QC9_MqVW22j)bY0zHPCeaar70}k^%t4IzI*@x
delta 1485
zcmZ|PUr19?7y$5d&+gsbbhVk-R7i1-0(G%_?>4u}2eZKpEF=cK#KmetWH@!Shk^+{
znU7x(LBq7nFe-AzQ;6u<$1o=?7&bjAn>Ol|eeBb$f=X~cfcDEE>
z3eS2et>{oo6ZE7Cee@u0Rbhh0=yw-9qz7nOgZDH?{VqtkCg}+cp0RLRg&s8oMep6Y
zF;9&GEAD;>YZ01P;FQ(@DLn-D)MljtF6-@}dHfLZcwkoFOWg$Ow0gM8D5W2v=hx?o
zx~9OW+xBGtR4SRN*BvmV{cKUiqBk>>p3h9D8{d|*nd#Ncd^$kbfX13HrKgmq8)Ltd
zD&&Ra5%dMgW9W;LA4VrGC#g>lX>hW5K05
zNp-q{eq3_#$O^eG`4sMdDftX~8OD6UlCD)RaFUx??UVe@4*mc=E$x4Vo|pVFdO>)|
zS@P*Q7M@54*kkSrDhqrrE#scw(w>j#&2A^DPT$a5Bwt1Ek^ILF{!4g?+>j2e;el6@
zucN<_TvK>KAs;07p?{XV9^I?+a~nTS(zK<(i(<5**E$FOD54@z#Kf7KMvXdgPnvt>%Lxd>g0}XA%
z%}$}sVL~hVgia-
zTD9;z6!E90UM+49J+xr87}0|$2nuS5K}19isD$>Q&hEaLb|A|#Z{~aN&6~07{22Yy
zHusg07hj*2+MLH96hI-xxk;|0P4Bb4Uq<#5IO8dq4kcACqj`jcMxB%Nv)v2X(%@c8+~aMlxs
zWA5d2QY+E^>fgjVo}O=zmu2|w?giZyBKykl&UIez@jYqcvmi&L%vIiap}soiA{=m_!IKy36=h^pA|I=&PiK58YYAAL4`jQbI7dm1Pf{
zQKd`=wxyWs4x)E6ez=Ce#xc`OeJ9r2yot(SGj>^?;p&-0FE$J^ey)b+aPT9hz7Oly
z_!bVnj2<+7clA+&m{6F8o9HUzx6#w!h)R4~Z;wW8Fdc8+rE;1URyC!C)8w$G#H)sD5b%ujA%w-M1y>MlY1L=S=D4JEn3)I6}S@*t}_z!Zkc9`Mp?mV)WkHI
NUMt7+uGVKu{sGrLyA=Qc
delta 1384
zcmZ|NZ%9*76aet|?q;n&ZtdTDb1*C2l8nN)t!?6<2~GD&BU%5Jyb24c5RnLyVuK(U
zWkkn7#E=mBZ0u76{Zm?oQPGE>$WK}Hp*|TAO6%UYW9mU4Q{TDuPcI(JCDz12clT4-)^1K1BQ{y3d_3
zR*T`+s?N_J#e+M@z%BG);_q>zFT@wnZA!veEe130<0QUWc$UA}VN!7701)@C;S%~C
z(!U-3De;}?liUM~w-i~!f<;X%XDJ5nBC5Pk#HD7A
HUv2ycY1X &mut NameTree {
- if !self.table.contains_key(&file_id) {
- self.table.insert(file_id, Default::default());
- }
+ self.table.entry(file_id).or_default();
self.table.get_mut(&file_id).unwrap()
}
diff --git a/src/root/parser/location.rs b/src/root/parser/location.rs
index 0654e04..d3470f9 100644
--- a/src/root/parser/location.rs
+++ b/src/root/parser/location.rs
@@ -23,7 +23,7 @@ impl<'a> ToLocation<'a> {
ToLocation::Span(span)
}
- pub fn to_location(self) -> Location {
+ pub fn into_location(self) -> Location {
match self {
ToLocation::Location(location) => location,
ToLocation::Span(s) => Location::from_span(&s),
diff --git a/src/root/parser/parse.rs b/src/root/parser/parse.rs
index 005f802..e21791e 100644
--- a/src/root/parser/parse.rs
+++ b/src/root/parser/parse.rs
@@ -28,18 +28,18 @@ pub fn parse(path_storage: &mut PathStorage) -> Result, WErr
print!("\n - {}", &reconstructed);
let Ok(text) = fs::read_to_string(Path::new(&reconstructed)) else {
return WErr::ne(
- ParseError::FailedToOpenFile(format!("{}", reconstructed)),
+ ParseError::FailedToOpenFile(reconstructed.to_string()),
location,
);
};
let base = Span::new_extra(&text, file_id);
- let (after_use, new_files) = handle_error(parse_uses(base, path_storage), &path_storage)?;
+ let (after_use, new_files) = handle_error(parse_uses(base, path_storage), path_storage)?;
path_queue.extend(new_files);
let res = parse_toplevel::parse_toplevel(after_use);
- let (remaining, new_output) = handle_error(res, &path_storage)?;
+ let (remaining, new_output) = handle_error(res, path_storage)?;
debug_assert!(remaining.is_empty());
output.extend(new_output);
}
diff --git a/src/root/parser/parse_blocks.rs b/src/root/parser/parse_blocks.rs
index bbc750e..dc7c8fe 100644
--- a/src/root/parser/parse_blocks.rs
+++ b/src/root/parser/parse_blocks.rs
@@ -1,7 +1,7 @@
-use nom::{InputTake, Offset};
use nom::bytes::complete::tag;
use nom::character::complete::{anychar, char as nchar};
use nom::error::{ErrorKind, ParseError};
+use nom::{InputTake, Offset};
use crate::root::errors::parser_errors::create_custom_error;
use crate::root::parser::parse::{ErrorTree, ParseResult, Span};
diff --git a/src/root/parser/path_storage.rs b/src/root/parser/path_storage.rs
index 213cde4..dfefaa7 100644
--- a/src/root/parser/path_storage.rs
+++ b/src/root/parser/path_storage.rs
@@ -105,7 +105,7 @@ impl PathStorage {
}
pub fn reconstruct_folder(&self, id: FolderID) -> String {
- let mut sb = format!("{}", &self.get_folder(id).current);
+ let mut sb = self.get_folder(id).current.to_string();
let mut current = self.get_folder(id).parent;
while current.0 != 0 {
sb = self.get_folder(current).current.clone() + "/" + &sb;
diff --git a/src/root/shared/common.rs b/src/root/shared/common.rs
index 52822f2..a495950 100644
--- a/src/root/shared/common.rs
+++ b/src/root/shared/common.rs
@@ -67,9 +67,7 @@ impl Indirection {
}
}
-#[derive(
- Debug, PartialEq, Eq, Hash, Copy, Clone, Default, Add, AddAssign, Sub, SubAssign,
-)]
+#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Default, Add, AddAssign, Sub, SubAssign)]
/// The size of something, in bytes
pub struct ByteSize(pub usize);