From 6ed299286223654f1a89635c93c06d4b57062f9a Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 6 May 2018 07:03:11 +0200 Subject: [PATCH] Remove unused variables --- dscanner.ini | 2 +- source/tanya/container/buffer.d | 13 +++++-------- source/tanya/math/package.d | 1 - source/tanya/memory/mallocator.d | 1 + 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dscanner.ini b/dscanner.ini index 1f0c36b..a4b05f9 100644 --- a/dscanner.ini +++ b/dscanner.ini @@ -23,7 +23,7 @@ if_else_same_check="skip-unittest" ; Checks for some problems with constructors constructor_check="skip-unittest" ; Checks for unused variables and function parameters -unused_variable_check="disabled" +unused_variable_check="skip-unittest" ; Checks for unused labels unused_label_check="skip-unittest" ; Checks for duplicate attributes diff --git a/source/tanya/container/buffer.d b/source/tanya/container/buffer.d index 739a280..c0fa019 100644 --- a/source/tanya/container/buffer.d +++ b/source/tanya/container/buffer.d @@ -20,7 +20,6 @@ import tanya.meta.trait; version (unittest) { private int fillBuffer(ubyte[] buffer, - in size_t size, int start = 0, int end = 10) @nogc pure nothrow in @@ -173,7 +172,7 @@ struct ReadBuffer(T = ubyte) assert(b.free == 0); // Fills the buffer with values 0..10 - numberRead = fillBuffer(b[], b.free, 0, 10); + numberRead = fillBuffer(b[], 0, 10); b += numberRead; assert(b.free == b.blockSize - numberRead); b.clear(); @@ -204,7 +203,7 @@ struct ReadBuffer(T = ubyte) ubyte[] result; // Fills the buffer with values 0..10 - numberRead = fillBuffer(b[], b.free, 0, 10); + numberRead = fillBuffer(b[], 0, 10); b += numberRead; result = b[0 .. $]; @@ -214,10 +213,10 @@ struct ReadBuffer(T = ubyte) b.clear(); // It shouldn't overwrite, but append another 5 bytes to the buffer - numberRead = fillBuffer(b[], b.free, 0, 10); + numberRead = fillBuffer(b[], 0, 10); b += numberRead; - numberRead = fillBuffer(b[], b.free, 20, 25); + numberRead = fillBuffer(b[], 20, 25); b += numberRead; result = b[0..$]; @@ -279,7 +278,7 @@ struct ReadBuffer(T = ubyte) ubyte[] result; // Fills the buffer with values 0..10 - numberRead = fillBuffer(b[], b.free, 0, 10); + numberRead = fillBuffer(b[], 0, 10); b += numberRead; assert(b.length == 10); @@ -599,8 +598,6 @@ struct WriteBuffer(T = ubyte) */ T[] opSlice(in size_t start, in size_t end) { - immutable internStart = this.start + start; - if (position > ring || position < start) // Buffer overflowed { return buffer_[this.start .. ring + 1 - length + end]; diff --git a/source/tanya/math/package.d b/source/tanya/math/package.d index 73b254c..58c7ad9 100644 --- a/source/tanya/math/package.d +++ b/source/tanya/math/package.d @@ -632,7 +632,6 @@ do size_t i; auto tmp1 = Integer(x, x.allocator); auto result = Integer(x.allocator); - bool firstBit; if (x.size == 0 && y.size != 0) { diff --git a/source/tanya/memory/mallocator.d b/source/tanya/memory/mallocator.d index f9e65cd..f7379e8 100644 --- a/source/tanya/memory/mallocator.d +++ b/source/tanya/memory/mallocator.d @@ -104,6 +104,7 @@ final class Mallocator : Allocator bool reallocateInPlace(ref void[] p, size_t size) @nogc nothrow pure shared @system { + cast(void) size; return false; }