     (lambda (errors)
       (merlin-error-reset)
       (let ((no-loc (remove-if (lambda (e) (assoc 'start e)) errors)))
-        (setq errors (remove-if (lambda (e) (not (assoc 'start e))) errors))
+        (setq errors (remove-if-not (lambda (e) (assoc 'start e)) errors))
         (unless merlin-report-warnings
           (setq errors (remove-if (lambda (e)
                                     (merlin-error-warning-p (cdr (assoc 'message e))))
                                   errors)))
-        (when (or errors no-loc)
-          (setq merlin-erroneous-buffer t)
-          (when no-loc
-            (mapcar (lambda (e) (message "%s" (cdr (assoc 'message e)))) no-loc))
-          (when errors
-            (merlin-transform-display-errors errors)))))))
+        (setq merlin-erroneous-buffer (or errors no-loc))
+        (dolist (e no-loc)
+          (message "%s" (cdr (assoc 'message e))))
+        (merlin-transform-display-errors errors)))))
 
 (defun merlin--error-check (view-errors-p)
   "Check for errors.

  "Compute the prefix of IDENT.  The prefix of `Foo.bar' is `Foo.' and the prefix of `bar' is `'."
  (car (merlin--completion-split-ident ident)))

(defvar-local dwimed nil
  "Remember if we used dwim for the current completion or not")

(defun merlin--completion-full-entry-name (compl-prefix entry)
  (let ((entry-name (cdr (assoc 'name entry))))
    (if dwimed entry-name (concat compl-prefix entry-name))))

(defun merlin--completion-prepare-labels (labels suffix)
  ; Remove non-matching entry, adjusting optional labels if needed

(defun merlin--completion-data (ident)
  "Return the data for completion of IDENT, i.e. a list of lists of the form
  '(NAME TYPE KIND INFO)."
  (setq-local merlin--dwimed nil)
  (let* ((ident- (merlin--completion-split-ident ident))
         (suffix (cdr ident-))
         (prefix (car ident-))
