From 1ebcaf6f971377ff8a8cfb6ff60ea4581f69f7d3 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Sat, 13 Dec 2025 12:32:01 +0100 Subject: [PATCH] Move init variable in if. --- src/stream_related.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/stream_related.cpp b/src/stream_related.cpp index a863685..7fcac3c 100644 --- a/src/stream_related.cpp +++ b/src/stream_related.cpp @@ -3,8 +3,7 @@ namespace safe_cuda { std::variant, cudaError_t> create_stream() noexcept { cudaStream_t stream = nullptr; - const cudaError_t error = cudaStreamCreate(&stream); - if (error != cudaSuccess) { + if (const cudaError_t error = cudaStreamCreate(&stream); error != cudaSuccess) { return error; } return std::unique_ptr{ stream, cudaStreamDestroy };