From 712469a281e1bf93d7f036fc8b9747046ff48eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Nordl=C3=B6w?= Date: Sun, 5 Dec 2021 18:45:08 +0100 Subject: [PATCH] Use return scope in ScopedBuffer members --- source/mir/appender.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/mir/appender.d b/source/mir/appender.d index 7e6c0b72..2a1593d0 100644 --- a/source/mir/appender.d +++ b/source/mir/appender.d @@ -29,12 +29,12 @@ struct ScopedBuffer(T, size_t bytes = 4096) else private align(T.alignof) ubyte[_bufferLength * T.sizeof] _scopeBufferPayload = void; - private ref inout(T[_bufferLength]) _scopeBuffer() inout @trusted scope + private ref inout(T[_bufferLength]) _scopeBuffer() inout @trusted return scope { return *cast(inout(T[_bufferLength])*)&_scopeBufferPayload; } - private T[] prepare(size_t n) @trusted scope + private T[] prepare(size_t n) @trusted return scope { import mir.internal.memory: realloc, malloc; _currentLength += n; @@ -210,7 +210,7 @@ struct ScopedBuffer(T, size_t bytes = 4096) } /// - inout(T)[] data() inout @property @safe scope + inout(T)[] data() inout @property @safe return scope { return _buffer.length ? _buffer[0 .. _currentLength] : _scopeBuffer[0 .. _currentLength]; }