Minor: do not use !! operator when a smart cast is possible
authorVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Wed, 29 Nov 2017 14:39:02 +0000 (17:39 +0300)
committerVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Tue, 19 Dec 2017 08:32:31 +0000 (11:32 +0300)
plugins/stats-collector/src/com/intellij/stats/completion/CompletionActionsTracker.kt

index 1b86042faeef7dbb0e492473f7caf81c96fa660f..e1eb85121b0d752b9e76f96112c73cfedbdc3a12 100644 (file)
@@ -44,13 +44,14 @@ class CompletionActionsTracker(private val lookup: LookupImpl,
         if (!completionStarted) return
 
         val items = lookup.items
-        if (lookup.currentItem == null) {
+        val currentItem = lookup.currentItem
+        if (currentItem == null) {
             deferredLog.clear()
             logger.completionCancelled()
             return
         }
 
-        val prefix = lookup.itemPattern(lookup.currentItem!!)
+        val prefix = lookup.itemPattern(currentItem)
         val wasTyped = items.firstOrNull()?.lookupString?.equals(prefix) ?: false
         if (wasTyped || selectedByDotTyping) {
             deferredLog.log()