summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2020-01-03 10:28:56 +0000
committerdakkar <dakkar@thenautilus.net>2020-01-03 10:28:56 +0000
commit081b9f0d83cf3e0674cd4314b7f6df5062642c19 (patch)
treed5700424f740bc2fb889271bec9414e4ba1a30d3
parentI don't understand this context/flat thing (diff)
downloadMaildirIndexer-081b9f0d83cf3e0674cd4314b7f6df5062642c19.tar.gz
MaildirIndexer-081b9f0d83cf3e0674cd4314b7f6df5062642c19.tar.bz2
MaildirIndexer-081b9f0d83cf3e0674cd4314b7f6df5062642c19.zip
binding FTW
-rw-r--r--lib/MaildirIndexer/Index/ByAddresses.rakumod11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/MaildirIndexer/Index/ByAddresses.rakumod b/lib/MaildirIndexer/Index/ByAddresses.rakumod
index 507c0e7..638740f 100644
--- a/lib/MaildirIndexer/Index/ByAddresses.rakumod
+++ b/lib/MaildirIndexer/Index/ByAddresses.rakumod
@@ -36,7 +36,7 @@ method add-mail(MaildirIndexer::Email:D $email, Str:D $mailbox --> Nil) {
return if %!addresses-for-file{ $email.path }:exists;
my Str @addresses = $email.addresses or return;
- %!addresses-for-file{ $email.path } = @addresses;
+ %!addresses-for-file{ $email.path } := @addresses;
self.account-for(@addresses,$mailbox,1);
@@ -46,12 +46,13 @@ method add-mail(MaildirIndexer::Email:D $email, Str:D $mailbox --> Nil) {
method del-path(IO:D $file, Str:D $mailbox --> Nil) {
MaildirIndexer::LogTimelineSchema::Index::Rm.log: :class('ByAddresses'),:$mailbox, -> {
- # using `Str @addresses` fails when the path isn't present in
+ # using assignment would fail when the path isn't present in
# the hash, because it tries to assign the (undefined)
- # Array[Str] as a single element, instead of splatting it
- my Array[Str] $addresses = %!addresses-for-file{$file.path}:delete or return;
+ # Array[Str] as a single element, instead of splatting it;
+ # also, binding is faster because it avoids a copy
+ my Str @addresses := %!addresses-for-file{$file.path}:delete or return;
- self.account-for($addresses,$mailbox,-1);
+ self.account-for(@addresses,$mailbox,-1);
return;
}