From db586d552f174feec0b97fdfc8e048e0f3033577 Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Fri, 1 Jun 2018 18:11:36 +0100 Subject: [PATCH] silence warning (#456) Motivation: Swift has a rather unhelpful warning warning: treating a forced downcast to 'EmbeddedEventLoop' as optional will never produce 'nil' when assigning that to a variable of type `EmbeddedEventLoop!`. The warning is accurate but obviously we know that can never be `nil`. The way to silence this warning is to put parenthesis around the expression. Modifications: added parenthesis around force casts that are assigned to IUOs Result: fewer warnings with 4.2 --- Tests/NIOHTTP1Tests/HTTPDecoderLengthTest.swift | 2 +- Tests/NIOHTTP1Tests/HTTPDecoderTest.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/NIOHTTP1Tests/HTTPDecoderLengthTest.swift b/Tests/NIOHTTP1Tests/HTTPDecoderLengthTest.swift index 1f8e2593..82954d4a 100644 --- a/Tests/NIOHTTP1Tests/HTTPDecoderLengthTest.swift +++ b/Tests/NIOHTTP1Tests/HTTPDecoderLengthTest.swift @@ -55,7 +55,7 @@ class HTTPDecoderLengthTest: XCTestCase { override func setUp() { self.channel = EmbeddedChannel() - self.loop = channel.eventLoop as! EmbeddedEventLoop + self.loop = (channel.eventLoop as! EmbeddedEventLoop) } override func tearDown() { diff --git a/Tests/NIOHTTP1Tests/HTTPDecoderTest.swift b/Tests/NIOHTTP1Tests/HTTPDecoderTest.swift index 776bff07..73673f53 100644 --- a/Tests/NIOHTTP1Tests/HTTPDecoderTest.swift +++ b/Tests/NIOHTTP1Tests/HTTPDecoderTest.swift @@ -23,7 +23,7 @@ class HTTPDecoderTest: XCTestCase { override func setUp() { self.channel = EmbeddedChannel() - self.loop = channel.eventLoop as! EmbeddedEventLoop + self.loop = (channel.eventLoop as! EmbeddedEventLoop) } override func tearDown() {