all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#57669: 29.0.50; C-n, C-p off under long lines
@ 2022-09-08  5:40 dick.r.chiang
  2022-09-08  7:38 ` Gregory Heytings
  2022-09-08  8:17 ` Eli Zaretskii
  0 siblings, 2 replies; 54+ messages in thread
From: dick.r.chiang @ 2022-09-08  5:40 UTC (permalink / raw)
  To: 57669


Try C-n through a file with long lines.  It jumps around.

src/emacs -Q -l cl-lib --eval " \
(let ((long-line-threshold 10000)                                 \
      (file (make-temp-file \"baz\")))				  \
  (cl-assert (= 80 (window-width)) t)				  \
  (with-temp-file file						  \
    (insert (make-string (1+ long-line-threshold) ?x)))		  \
  (dolist (toggle (list nil long-line-threshold))		  \
    (let* ((long-line-threshold toggle)				  \
	   (note (format \"long-line-threshold = %s\"		  \
			 long-line-threshold))			  \
	   (buffer (find-file-literally file)))			  \
      (with-current-buffer buffer				  \
	(show-paren-mode -1)					  \
	(goto-char (point-min))					  \
	(catch (quote done)					  \
	  (while (condition-case nil				  \
		     (prog1 t (call-interactively		  \
			       (function next-line)))		  \
		   (end-of-buffer))				  \
	    (redisplay)						  \
	    (unless (zerop (% (current-column) (window-width)))	  \
	      (princ (format \"BAD under %s (column is %d)\n\"	  \
			     note (current-column))		  \
		     (function external-debugging-output))	  \
	      (throw (quote done) nil)))			  \
	  (princ (format \"GOOD under %s (column is %d)\n\"	  \
			 note (current-column))			  \
		 (function external-debugging-output))))	  \
      (kill-buffer buffer))))"


In Commercial Emacs 0.3.1snapshot e6f9ecd in dev (upstream 29.0.50,
x86_64-pc-linux-gnu) built on dick
Repository revision: e6f9ecde2eaaa40ddb78b88b81f612b1e8ec1665
Repository branch: dev
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.4 LTS

Configured using:
 'configure WERROR_CFLAGS=-Werror --prefix=/home/dick/.local
 --with-tree-sitter'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
TREE_SITTER LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB
Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  shell-dirtrack-mode: t
  gnus-topic-mode: t
  gnus-undo-mode: t
  projectile-mode: t
  flx-ido-mode: t
  override-global-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  winner-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/dick/gomacro-mode/gomacro-mode hides /home/dick/.emacs.d/elpa/gomacro-mode-20200326.1103/gomacro-mode
/home/dick/.emacs.d/elpa/go-rename-20190805.2101/go-rename hides /home/dick/.emacs.d/elpa/go-mode-1.6.0/go-rename
/home/dick/.emacs.d/elpa/go-guru-20181012.330/go-guru hides /home/dick/.emacs.d/elpa/go-mode-1.6.0/go-guru
/home/dick/org-gcal.el/org-gcal hides /home/dick/.emacs.d/elpa/org-gcal-0.3/org-gcal
/home/dick/.emacs.d/elpa/request-deferred-0.2.0/request-deferred hides /home/dick/.emacs.d/elpa/request-0.3.3/request-deferred
/home/dick/.emacs.d/elpa/chess-2.0.5/_pkg hides /home/dick/.local/share/emacs/site-lisp/_pkg
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-pos hides /home/dick/.local/share/emacs/site-lisp/chess-pos
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-module hides /home/dick/.local/share/emacs/site-lisp/chess-module
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ucb hides /home/dick/.local/share/emacs/site-lisp/chess-ucb
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-scid hides /home/dick/.local/share/emacs/site-lisp/chess-scid
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-puzzle hides /home/dick/.local/share/emacs/site-lisp/chess-puzzle
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-irc hides /home/dick/.local/share/emacs/site-lisp/chess-irc
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-network hides /home/dick/.local/share/emacs/site-lisp/chess-network
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-autosave hides /home/dick/.local/share/emacs/site-lisp/chess-autosave
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-engine hides /home/dick/.local/share/emacs/site-lisp/chess-engine
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-tutorial hides /home/dick/.local/share/emacs/site-lisp/chess-tutorial
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-german hides /home/dick/.local/share/emacs/site-lisp/chess-german
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-file hides /home/dick/.local/share/emacs/site-lisp/chess-file
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-random hides /home/dick/.local/share/emacs/site-lisp/chess-random
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-stockfish hides /home/dick/.local/share/emacs/site-lisp/chess-stockfish
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-pgn hides /home/dick/.local/share/emacs/site-lisp/chess-pgn
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-kibitz hides /home/dick/.local/share/emacs/site-lisp/chess-kibitz
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-eco hides /home/dick/.local/share/emacs/site-lisp/chess-eco
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-display hides /home/dick/.local/share/emacs/site-lisp/chess-display
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-var hides /home/dick/.local/share/emacs/site-lisp/chess-var
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-test hides /home/dick/.local/share/emacs/site-lisp/chess-test
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ply hides /home/dick/.local/share/emacs/site-lisp/chess-ply
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-message hides /home/dick/.local/share/emacs/site-lisp/chess-message
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics1 hides /home/dick/.local/share/emacs/site-lisp/chess-ics1
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-phalanx hides /home/dick/.local/share/emacs/site-lisp/chess-phalanx
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-game hides /home/dick/.local/share/emacs/site-lisp/chess-game
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-log hides /home/dick/.local/share/emacs/site-lisp/chess-log
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-plain hides /home/dick/.local/share/emacs/site-lisp/chess-plain
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-perft hides /home/dick/.local/share/emacs/site-lisp/chess-perft
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-glaurung hides /home/dick/.local/share/emacs/site-lisp/chess-glaurung
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ai hides /home/dick/.local/share/emacs/site-lisp/chess-ai
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-fruit hides /home/dick/.local/share/emacs/site-lisp/chess-fruit
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-uci hides /home/dick/.local/share/emacs/site-lisp/chess-uci
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-epd hides /home/dick/.local/share/emacs/site-lisp/chess-epd
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-database hides /home/dick/.local/share/emacs/site-lisp/chess-database
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-link hides /home/dick/.local/share/emacs/site-lisp/chess-link
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-transport hides /home/dick/.local/share/emacs/site-lisp/chess-transport
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-none hides /home/dick/.local/share/emacs/site-lisp/chess-none
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-polyglot hides /home/dick/.local/share/emacs/site-lisp/chess-polyglot
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-crafty hides /home/dick/.local/share/emacs/site-lisp/chess-crafty
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-chat hides /home/dick/.local/share/emacs/site-lisp/chess-chat
/home/dick/.emacs.d/elpa/chess-2.0.5/chess hides /home/dick/.local/share/emacs/site-lisp/chess
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-images hides /home/dick/.local/share/emacs/site-lisp/chess-images
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-gnuchess hides /home/dick/.local/share/emacs/site-lisp/chess-gnuchess
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-fen hides /home/dick/.local/share/emacs/site-lisp/chess-fen
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics hides /home/dick/.local/share/emacs/site-lisp/chess-ics
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics2 hides /home/dick/.local/share/emacs/site-lisp/chess-ics2
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-common hides /home/dick/.local/share/emacs/site-lisp/chess-common
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-input hides /home/dick/.local/share/emacs/site-lisp/chess-input
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-announce hides /home/dick/.local/share/emacs/site-lisp/chess-announce
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-clock hides /home/dick/.local/share/emacs/site-lisp/chess-clock
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-sound hides /home/dick/.local/share/emacs/site-lisp/chess-sound
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-sjeng hides /home/dick/.local/share/emacs/site-lisp/chess-sjeng
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-algebraic hides /home/dick/.local/share/emacs/site-lisp/chess-algebraic
/home/dick/.emacs.d/elpa/transient-0.3.7snapshot/transient hides /home/dick/.local/share/emacs/0.3.1/lisp/transient

Features:
(shadow sort bbdb-message footnote mail-extr emacsbug qp gnus-async
gnus-ml gnus-notifications gnus-fun notifications gnus-kill gnus-dup
disp-table utf-7 blamer a tramp tramp-loaddefs trampver
tramp-integration cus-start files-x tramp-compat shell pcomplete ls-lisp
url-cache benchmark nnrss nnfolder nndiscourse rbenv nnhackernews
nntwitter nntwitter-api bbdb-gnus gnus-demon nntp nnmairix nnml nnreddit
gnus-topic url-http url-auth url-gw network-stream nsm request
virtualenvwrapper gud s json-rpc python gnus-score score-mode gnus-bcklg
gnus-srvr gnus-cite anaphora bbdb-mua bbdb-com bbdb bbdb-site timezone
gnus-delay gnus-draft gnus-cache gnus-agent gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom nndraft nnmh gnus-group mm-url gnus-undo
use-package use-package-delight use-package-diminish gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message sendmail
yank-media puny dired-x dired dired-loaddefs rfc822 mml mml-sec epa epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win
paredit-ext paredit inf-ruby ruby-mode smie company pcase
haskell-interactive-mode haskell-presentation-mode haskell-process
haskell-session haskell-compile haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support noutline outline
flymake-proc flymake warnings etags fileloop generator dabbrev
haskell-customize hydra lv use-package-ensure solarized-theme
solarized-definitions projectile lisp-mnt ibuf-ext ibuffer
ibuffer-loaddefs thingatpt magit-autorevert autorevert filenotify
magit-git magit-base magit-section format-spec crm dash rx compat-27
compat-26 compat grep compile comint ansi-color gnus nnheader range
mail-utils mm-util mail-prsvr gnus-util text-property-search time-date
flx-ido flx google-translate-default-ui google-translate-core-ui
facemenu color ido google-translate-core google-translate-tk
google-translate-backend use-package-bind-key bind-key auto-complete
easy-mmode advice edmacro kmacro popup cus-edit pp cus-load icons
wid-edit emms-player-mplayer emms-player-simple emms emms-compat
cl-extra help-mode xref project use-package-core derived hl-line winner
ring acm-autoloads debbugs-autoloads eglot-autoloads
elpaso-disc-autoloads elpaso-autoloads find-func finder-inf
go-mode-autoloads json-reformat-autoloads json-snatcher-autoloads
lsp-bridge-autoloads magit-autoloads posframe-autoloads
projectile-autoloads markdown-mode-autoloads sml-mode-autoloads
epl-autoloads tornado-template-mode-autoloads typescript-mode-autoloads
request-autoloads info wordnut-autoloads yasnippet-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile cconv cldefs url-vars
cl-loaddefs cl-lib rmc iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 531228 40963)
 (symbols 48 34319 1)
 (strings 32 131931 13242)
 (string-bytes 1 4229331)
 (vectors 16 48586)
 (vector-slots 8 645891 28513)
 (floats 8 997 358)
 (intervals 56 511 0)
 (buffers 1008 25))





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08  5:40 bug#57669: 29.0.50; C-n, C-p off under long lines dick.r.chiang
@ 2022-09-08  7:38 ` Gregory Heytings
  2022-09-08  8:17 ` Eli Zaretskii
  1 sibling, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2022-09-08  7:38 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 57669-done


>
> Try C-n through a file with long lines.  It jumps around.
>

Thanks, but this is well-known, and is an (unavoidable) compromise.

Closing.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08  5:40 bug#57669: 29.0.50; C-n, C-p off under long lines dick.r.chiang
  2022-09-08  7:38 ` Gregory Heytings
@ 2022-09-08  8:17 ` Eli Zaretskii
  2022-09-08 12:02   ` dick
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-08  8:17 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 57669

> From: dick.r.chiang@gmail.com
> Date: Thu, 08 Sep 2022 01:40:01 -0400
> 
> 
> Try C-n through a file with long lines.  It jumps around.

That's expected, and is one of the prices we pay for reasonable
performance with such long lines: keeping the same column is no longer
guaranteed.  I see no problem with that, FWIW.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08  8:17 ` Eli Zaretskii
@ 2022-09-08 12:02   ` dick
  2022-09-08 17:12     ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-08 12:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> I see no problem with that, FWIW.

No problem?  None?  The fortune you could have made had you pursued a
career in corporate messaging.

In all the reams of tail-chasing in Bug#56682 and Bug#56393, I managed
to locate just one preemptive mention by the proposer:

  This feature comes at a (IMO) very little price, namely...
  point sometimes moves to another column...

He is careful to minimize the issue, but he doesn't say "I see no
problem with that."

Emacs devs are fascinating.  Even with no money or fame at stake, guys
choose the weirdest hills to die on.  One guy repudiated the long lines
fix over some cc-mode regression.  Another for imperfectly colorizing
json.  Another for circumstantially forbidding "widen".  But none of
them appeared to care the slightest about something as basic as "C-n"
and "C-p".  A "very little price" indeed.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08 12:02   ` dick
@ 2022-09-08 17:12     ` Gregory Heytings
  2022-09-08 18:13       ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-08 17:12 UTC (permalink / raw)
  To: dick; +Cc: Eli Zaretskii, 57669


>
> No problem?  None?
>

None, indeed.  Even without long lines, C-n and C-p are not 100% accurate.

>
> This feature comes at a (IMO) very little price, namely... point 
> sometimes moves to another column...
>

Indeed.

>
> He is careful to minimize the issue, but he doesn't say "I see no 
> problem with that."
>

I wasn't "careful to minimize the issue", I state what it was black on 
white.  I was careful to minimize its impact, however: it could have been 
much worse.  What we now have is that sometimes, but rarely, point moves 
to another column.  That doesn't make Emacs unusable, does it?

>
> A "very little price" indeed.
>

Indeed.  I'm glad to read you agree.  Or are the quotation marks supposed 
to convey something else?





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08 17:12     ` Gregory Heytings
@ 2022-09-08 18:13       ` dick
  2022-09-08 18:26         ` Gregory Heytings
  2022-09-09  6:00         ` Eli Zaretskii
  0 siblings, 2 replies; 54+ messages in thread
From: dick @ 2022-09-08 18:13 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

DRC> No Problem? None?
GH>  None, indeed.


[-- Attachment #2: languageclient.out --]
[-- Type: text/plain, Size: 584464 bytes --]

#######
LanguageClient 0.1.161
#######
16:30:46 DEBUG unnamed src/language_client.rs:108 state: null ==> {"capabilities":{},"code_lens":{},"diagnostics":{},"highlight_match_ids":[],"highlight_source":null,"highlights":{},"highlights_placed":{},"initialization_options":null,"inlay_hints":{},"last_cursor_line":0,"last_line_diagnostic":" ","logger":{"level":"DEBUG","path":"/tmp/shiz"},"namespace_ids":{},"registrations":[],"roots":{},"semantic_highlights":{},"semantic_scope_to_hl_group_table":{},"semantic_scopes":{},"stashed_code_action_actions":[],"text_documents":{},"text_documents_metadata":{},"user_handlers":{},"viewports":{}}
16:30:46 INFO unnamed src/language_server_protocol.rs:3580 settings synced
16:30:46 INFO unnamed src/language_server_protocol.rs:3607 Project root: /home/dick/LanguageClient-neovim
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:EchomsgEllipsis","params":["Project root: /home/dick/LanguageClient-neovim"]}
16:30:46 DEBUG unnamed src/language_client.rs:108 state.roots.rust: null ==> "/home/dick/LanguageClient-neovim"
16:30:46 INFO unnamed src/language_server_protocol.rs:840 initialize; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:command","params":["sign define LanguageClientWarning text= texthl=LanguageClientWarningSign","sign define LanguageClientError text= texthl=LanguageClientErrorSign","sign define LanguageClientInformation text= texthl=LanguageClientInfoSign","sign define LanguageClientHint text= texthl=LanguageClientInfoSign"]}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["s:hasSnippetSupport()"],"id":3}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 3, "jsonrpc": "2.0", "result": 0}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":false},"completion":{"completionItem":{"insertReplaceSupport":false,"snippetSupport":false}},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"hover":{},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true},"semanticHighlightingCapabilities":{"semanticHighlighting":true},"signatureHelp":{"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true}}},"typeDefinition":{"linkSupport":true}},"workspace":{"applyEdit":true,"didChangeWatchedFiles":{"dynamicRegistration":true}}},"clientInfo":{"name":"LanguageClient-neovim","version":"0.1.161"},"processId":243451,"rootPath":"/home/dick/LanguageClient-neovim","rootUri":"file:///home/dick/LanguageClient-neovim","trace":"off"},"id":0}
16:30:46 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"selectionRangeProvider":true,"hoverProvider":true,"completionProvider":{"triggerCharacters":[":",".","'","("],"completionItem":{"labelDetailsSupport":false}},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{"]},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"declarationProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"scheme":"file","pattern":{"glob":"**/*.rs","matches":"file"}},{"scheme":"file","pattern":{"glob":"**","matches":"folder"}}]}}},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"],"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","mutable","public","reference","trait","unsafe"]},"range":true,"full":{"delta":true}},"inlayHintProvider":{"resolveProvider":true},"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true}},"serverInfo":{"name":"rust-analyzer","version":"0.0.0 (8ddb8b7e8 2022-09-03)"}}}
16:30:46 DEBUG unnamed src/language_client.rs:108 state.capabilities.rust: null ==> {"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"completionProvider":{"triggerCharacters":[":",".","'","("]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{"]},"documentRangeFormattingProvider":false,"documentSymbolProvider":true,"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","mutable","public","reference","trait","unsafe"],"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"]},"range":true},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"textDocumentSync":{"change":2,"openClose":true,"save":{}},"typeDefinitionProvider":true,"workspace":{},"workspaceSymbolProvider":true},"serverInfo":{"name":"rust-analyzer","version":"0.0.0 (8ddb8b7e8 2022-09-03)"}}
16:30:46 INFO unnamed src/language_server_protocol.rs:567 register_cm_source; language_id="rust" result=Object({"capabilities": Object({"callHierarchyProvider": Bool(true), "codeActionProvider": Object({"codeActionKinds": Array([String(""), String("quickfix"), String("refactor"), String("refactor.extract"), String("refactor.inline"), String("refactor.rewrite")]), "resolveProvider": Bool(true)}), "codeLensProvider": Object({"resolveProvider": Bool(true)}), "completionProvider": Object({"completionItem": Object({"labelDetailsSupport": Bool(false)}), "triggerCharacters": Array([String(":"), String("."), String("'"), String("(")])}), "declarationProvider": Bool(true), "definitionProvider": Bool(true), "documentFormattingProvider": Bool(true), "documentHighlightProvider": Bool(true), "documentOnTypeFormattingProvider": Object({"firstTriggerCharacter": String("="), "moreTriggerCharacter": Array([String("."), String(">"), String("{")])}), "documentRangeFormattingProvider": Bool(false), "documentSymbolProvider": Bool(true), "experimental": Object({"externalDocs": Bool(true), "hoverRange": Bool(true), "joinLines": Bool(true), "matchingBrace": Bool(true), "moveItem": Bool(true), "onEnter": Bool(true), "openCargoToml": Bool(true), "parentModule": Bool(true), "runnables": Object({"kinds": Array([String("cargo")])}), "ssr": Bool(true), "workspaceSymbolScopeKindFiltering": Bool(true)}), "foldingRangeProvider": Bool(true), "hoverProvider": Bool(true), "implementationProvider": Bool(true), "inlayHintProvider": Object({"resolveProvider": Bool(true)}), "referencesProvider": Bool(true), "renameProvider": Object({"prepareProvider": Bool(true)}), "selectionRangeProvider": Bool(true), "semanticTokensProvider": Object({"full": Object({"delta": Bool(true)}), "legend": Object({"tokenModifiers": Array([String("documentation"), String("declaration"), String("static"), String("defaultLibrary"), String("async"), String("attribute"), String("callable"), String("constant"), String("consuming"), String("controlFlow"), String("crateRoot"), String("injected"), String("intraDocLink"), String("library"), String("mutable"), String("public"), String("reference"), String("trait"), String("unsafe")]), "tokenTypes": Array([String("comment"), String("decorator"), String("enumMember"), String("enum"), String("function"), String("interface"), String("keyword"), String("macro"), String("method"), String("namespace"), String("number"), String("operator"), String("parameter"), String("property"), String("string"), String("struct"), String("typeParameter"), String("variable"), String("angle"), String("arithmetic"), String("attribute"), String("attributeBracket"), String("bitwise"), String("boolean"), String("brace"), String("bracket"), String("builtinAttribute"), String("builtinType"), String("character"), String("colon"), String("comma"), String("comparison"), String("constParameter"), String("derive"), String("deriveHelper"), String("dot"), String("escapeSequence"), String("formatSpecifier"), String("generic"), String("label"), String("lifetime"), String("logical"), String("macroBang"), String("parenthesis"), String("punctuation"), String("selfKeyword"), String("selfTypeKeyword"), String("semicolon"), String("typeAlias"), String("toolModule"), String("union"), String("unresolvedReference")])}), "range": Bool(true)}), "signatureHelpProvider": Object({"triggerCharacters": Array([String("("), String(","), String("<")])}), "textDocumentSync": Object({"change": Number(2), "openClose": Bool(true), "save": Object({})}), "typeDefinitionProvider": Bool(true), "workspace": Object({"fileOperations": Object({"willRename": Object({"filters": Array([Object({"pattern": Object({"glob": String("**/*.rs"), "matches": String("file")}), "scheme": String("file")}), Object({"pattern": Object({"glob": String("**"), "matches": String("folder")}), "scheme": String("file")})])})})}), "workspaceSymbolProvider": Bool(true)}), "serverInfo": Object({"name": String("rust-analyzer"), "version": String("0.0.0 (8ddb8b7e8 2022-09-03)")})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["exists('g:cm_matcher')"],"id":4}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 4, "jsonrpc": "2.0", "result": 0}
16:30:46 INFO unnamed src/language_server_protocol.rs:607 register_ncm2_source; language_id="rust" result=Object({"capabilities": Object({"callHierarchyProvider": Bool(true), "codeActionProvider": Object({"codeActionKinds": Array([String(""), String("quickfix"), String("refactor"), String("refactor.extract"), String("refactor.inline"), String("refactor.rewrite")]), "resolveProvider": Bool(true)}), "codeLensProvider": Object({"resolveProvider": Bool(true)}), "completionProvider": Object({"completionItem": Object({"labelDetailsSupport": Bool(false)}), "triggerCharacters": Array([String(":"), String("."), String("'"), String("(")])}), "declarationProvider": Bool(true), "definitionProvider": Bool(true), "documentFormattingProvider": Bool(true), "documentHighlightProvider": Bool(true), "documentOnTypeFormattingProvider": Object({"firstTriggerCharacter": String("="), "moreTriggerCharacter": Array([String("."), String(">"), String("{")])}), "documentRangeFormattingProvider": Bool(false), "documentSymbolProvider": Bool(true), "experimental": Object({"externalDocs": Bool(true), "hoverRange": Bool(true), "joinLines": Bool(true), "matchingBrace": Bool(true), "moveItem": Bool(true), "onEnter": Bool(true), "openCargoToml": Bool(true), "parentModule": Bool(true), "runnables": Object({"kinds": Array([String("cargo")])}), "ssr": Bool(true), "workspaceSymbolScopeKindFiltering": Bool(true)}), "foldingRangeProvider": Bool(true), "hoverProvider": Bool(true), "implementationProvider": Bool(true), "inlayHintProvider": Object({"resolveProvider": Bool(true)}), "referencesProvider": Bool(true), "renameProvider": Object({"prepareProvider": Bool(true)}), "selectionRangeProvider": Bool(true), "semanticTokensProvider": Object({"full": Object({"delta": Bool(true)}), "legend": Object({"tokenModifiers": Array([String("documentation"), String("declaration"), String("static"), String("defaultLibrary"), String("async"), String("attribute"), String("callable"), String("constant"), String("consuming"), String("controlFlow"), String("crateRoot"), String("injected"), String("intraDocLink"), String("library"), String("mutable"), String("public"), String("reference"), String("trait"), String("unsafe")]), "tokenTypes": Array([String("comment"), String("decorator"), String("enumMember"), String("enum"), String("function"), String("interface"), String("keyword"), String("macro"), String("method"), String("namespace"), String("number"), String("operator"), String("parameter"), String("property"), String("string"), String("struct"), String("typeParameter"), String("variable"), String("angle"), String("arithmetic"), String("attribute"), String("attributeBracket"), String("bitwise"), String("boolean"), String("brace"), String("bracket"), String("builtinAttribute"), String("builtinType"), String("character"), String("colon"), String("comma"), String("comparison"), String("constParameter"), String("derive"), String("deriveHelper"), String("dot"), String("escapeSequence"), String("formatSpecifier"), String("generic"), String("label"), String("lifetime"), String("logical"), String("macroBang"), String("parenthesis"), String("punctuation"), String("selfKeyword"), String("selfTypeKeyword"), String("semicolon"), String("typeAlias"), String("toolModule"), String("union"), String("unresolvedReference")])}), "range": Bool(true)}), "signatureHelpProvider": Object({"triggerCharacters": Array([String("("), String(","), String("<")])}), "textDocumentSync": Object({"change": Number(2), "openClose": Bool(true), "save": Object({})}), "typeDefinitionProvider": Bool(true), "workspace": Object({"fileOperations": Object({"willRename": Object({"filters": Array([Object({"pattern": Object({"glob": String("**/*.rs"), "matches": String("file")}), "scheme": String("file")}), Object({"pattern": Object({"glob": String("**"), "matches": String("folder")}), "scheme": String("file")})])})})}), "workspaceSymbolProvider": Bool(true)}), "serverInfo": Object({"name": String("rust-analyzer"), "version": String("0.0.0 (8ddb8b7e8 2022-09-03)")})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["exists('g:ncm2_loaded')"],"id":5}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 5, "jsonrpc": "2.0", "result": 0}
16:30:46 INFO unnamed src/language_server_protocol.rs:647 parse_semantic_scopes; language_id="rust" result=Object({"capabilities": Object({"callHierarchyProvider": Bool(true), "codeActionProvider": Object({"codeActionKinds": Array([String(""), String("quickfix"), String("refactor"), String("refactor.extract"), String("refactor.inline"), String("refactor.rewrite")]), "resolveProvider": Bool(true)}), "codeLensProvider": Object({"resolveProvider": Bool(true)}), "completionProvider": Object({"completionItem": Object({"labelDetailsSupport": Bool(false)}), "triggerCharacters": Array([String(":"), String("."), String("'"), String("(")])}), "declarationProvider": Bool(true), "definitionProvider": Bool(true), "documentFormattingProvider": Bool(true), "documentHighlightProvider": Bool(true), "documentOnTypeFormattingProvider": Object({"firstTriggerCharacter": String("="), "moreTriggerCharacter": Array([String("."), String(">"), String("{")])}), "documentRangeFormattingProvider": Bool(false), "documentSymbolProvider": Bool(true), "experimental": Object({"externalDocs": Bool(true), "hoverRange": Bool(true), "joinLines": Bool(true), "matchingBrace": Bool(true), "moveItem": Bool(true), "onEnter": Bool(true), "openCargoToml": Bool(true), "parentModule": Bool(true), "runnables": Object({"kinds": Array([String("cargo")])}), "ssr": Bool(true), "workspaceSymbolScopeKindFiltering": Bool(true)}), "foldingRangeProvider": Bool(true), "hoverProvider": Bool(true), "implementationProvider": Bool(true), "inlayHintProvider": Object({"resolveProvider": Bool(true)}), "referencesProvider": Bool(true), "renameProvider": Object({"prepareProvider": Bool(true)}), "selectionRangeProvider": Bool(true), "semanticTokensProvider": Object({"full": Object({"delta": Bool(true)}), "legend": Object({"tokenModifiers": Array([String("documentation"), String("declaration"), String("static"), String("defaultLibrary"), String("async"), String("attribute"), String("callable"), String("constant"), String("consuming"), String("controlFlow"), String("crateRoot"), String("injected"), String("intraDocLink"), String("library"), String("mutable"), String("public"), String("reference"), String("trait"), String("unsafe")]), "tokenTypes": Array([String("comment"), String("decorator"), String("enumMember"), String("enum"), String("function"), String("interface"), String("keyword"), String("macro"), String("method"), String("namespace"), String("number"), String("operator"), String("parameter"), String("property"), String("string"), String("struct"), String("typeParameter"), String("variable"), String("angle"), String("arithmetic"), String("attribute"), String("attributeBracket"), String("bitwise"), String("boolean"), String("brace"), String("bracket"), String("builtinAttribute"), String("builtinType"), String("character"), String("colon"), String("comma"), String("comparison"), String("constParameter"), String("derive"), String("deriveHelper"), String("dot"), String("escapeSequence"), String("formatSpecifier"), String("generic"), String("label"), String("lifetime"), String("logical"), String("macroBang"), String("parenthesis"), String("punctuation"), String("selfKeyword"), String("selfTypeKeyword"), String("semicolon"), String("typeAlias"), String("toolModule"), String("union"), String("unresolvedReference")])}), "range": Bool(true)}), "signatureHelpProvider": Object({"triggerCharacters": Array([String("("), String(","), String("<")])}), "textDocumentSync": Object({"change": Number(2), "openClose": Bool(true), "save": Object({})}), "typeDefinitionProvider": Bool(true), "workspace": Object({"fileOperations": Object({"willRename": Object({"filters": Array([Object({"pattern": Object({"glob": String("**/*.rs"), "matches": String("file")}), "scheme": String("file")}), Object({"pattern": Object({"glob": String("**"), "matches": String("folder")}), "scheme": String("file")})])})})}), "workspaceSymbolProvider": Bool(true)}), "serverInfo": Object({"name": String("rust-analyzer"), "version": String("0.0.0 (8ddb8b7e8 2022-09-03)")})})
16:30:46 INFO unnamed src/language_server_protocol.rs:1019 initialized; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 INFO unnamed src/language_server_protocol.rs:666 update_semantic_highlight_tables; language_id="rust"
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"initialized","params":{}}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":6}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 6, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:30:46 INFO unnamed src/language_server_protocol.rs:1946 text_document_did_open; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_isServerRunning",1]}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"rust":{"all_targets":false,"build_on_save":true,"clippy_preference":"on","wait_to_build":0}}}}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientStarted"]}




16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"LSP#text","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs"],"id":7}
16:30:46 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]}}
16:30:46 ERROR unnamed src/rpchandler.rs:27 Error handling message: Message not handled: MethodCall { jsonrpc: Some(V2), method: "workspace/configuration", params: Map({"items": Array([Object({"section": String("rust-analyzer")})])}), id: Num(0) }

Message: {"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]},"id":0}

Error: Message not handled: MethodCall { jsonrpc: Some(V2), method: "workspace/configuration", params: Map({"items": Array([Object({"section": String("rust-analyzer")})])}), id: Num(0) }
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","error":{"code":-32603,"message":"Message not handled: MethodCall { jsonrpc: Some(V2), method: \"workspace/configuration\", params: Map({\"items\": Array([Object({\"section\": String(\"rust-analyzer\")})])}), id: Num(0) }"},"id":0}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 7, "jsonrpc": "2.0", "result": ["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};", "use anyhow::{anyhow, Result};", "use crossbeam::channel::{bounded, unbounded, Receiver, Sender};", "use log::*;", "use regex::Regex;", "use serde::{de::DeserializeOwned, Serialize};", "use std::io::Write;", "use std::str::FromStr;", "use std::{", "    collections::HashMap,", "    io::BufRead,", "    sync::atomic::{AtomicU64, Ordering},", "    thread,", "    time::Duration,", "};", "", "const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;", "", "lazy_static! {", "    // this regex is used to remove some additional fields that we get from some servers, namely:", "    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.", "    static ref RE_REMOVE_EXTRA_FIELDS: Regex =", "        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();", "}", "", "#[derive(Serialize)]", "pub struct RpcClient {", "    language_id: LanguageId,", "    #[serde(skip_serializing)]", "    id: AtomicU64,", "    #[serde(skip_serializing)]", "    writer_tx: Sender<RawMessage>,", "    #[serde(skip_serializing)]", "    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,", "    pub process_id: Option<u32>,", "}", "", "impl RpcClient {", "    #[allow(clippy::new_ret_no_self)]", "    pub fn new(", "        language_id: LanguageId,", "        reader: impl BufRead + Send + 'static,", "        writer: impl Write + Send + 'static,", "        process_id: Option<u32>,", "        sink: Sender<Call>,", "        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,", "    ) -> Result<Self> {", "        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();", "", "        let language_id_clone = language_id.clone();", "        let reader_thread_name = format!(\"reader-{:?}\", language_id);", "        let on_crash_clone = on_crash.clone();", "        thread::Builder::new()", "            .name(reader_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {", "                            on_crash_clone(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);", "                }", "            })?;", "", "        let (writer_tx, writer_rx) = unbounded();", "        let writer_thread_name = format!(\"writer-{:?}\", language_id);", "        let language_id_clone = language_id.clone();", "        thread::Builder::new()", "            .name(writer_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {", "                            on_crash(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);", "                }", "            })?;", "", "        Ok(Self {", "            language_id,", "            id: AtomicU64::default(),", "            process_id,", "            reader_tx,", "            writer_tx,", "        })", "    }", "", "    pub fn call<R: DeserializeOwned>(", "        &self,", "        method: impl AsRef<str>,", "        params: impl Serialize,", "    ) -> Result<R> {", "        let method = method.as_ref();", "        let id = self.id.fetch_add(1, Ordering::SeqCst);", "        let msg = jsonrpc_core::MethodCall {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            id: jsonrpc_core::Id::Num(id),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        let (tx, rx) = bounded(1);", "        self.reader_tx.send((id, tx))?;", "        self.writer_tx.send(RawMessage::MethodCall(msg))?;", "        // TODO: duration from config.", "        match rx.recv_timeout(Duration::from_secs(60))? {", "            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),", "            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,", "            // which we don't want to show to the user and should ignore, as the result of the", "            // request that triggered this error has been invalidated by changes to the state", "            // of the server, so we must handle this error specifically.", "            jsonrpc_core::Output::Failure(err)", "                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>", "            {", "                Err(anyhow::Error::from(LSError::ContentModified))", "            }", "            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),", "        }", "    }", "", "    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {", "        let method = method.as_ref();", "", "        let msg = jsonrpc_core::Notification {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        self.writer_tx.send(RawMessage::Notification(msg))?;", "        Ok(())", "    }", "", "    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {", "        let output = match result {", "            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                result: serde_json::to_value(ok)?,", "            }),", "            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                error: err.to_rpc_error(),", "            }),", "        };", "", "        self.writer_tx.send(RawMessage::Output(output))?;", "        Ok(())", "    }", "}", "", "fn loop_read(", "    reader: impl BufRead,", "    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,", "    sink: &Sender<Call>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut pending_outputs = HashMap::new();", "", "    // Count how many consequent empty lines.", "    let mut count_empty_lines = 0;", "", "    let mut reader = reader;", "    let mut content_length = 0;", "    loop {", "        let mut message = String::new();", "        let mut line = String::new();", "        if language_id.is_some() {", "            reader.read_line(&mut line)?;", "            let line = line.trim();", "            if line.is_empty() {", "                count_empty_lines += 1;", "                if count_empty_lines > 5 {", "                    return Err(anyhow!(\"Unable to read from language server\"));", "                }", "", "                let mut buf = vec![0; content_length];", "                reader.read_exact(buf.as_mut_slice())?;", "                message = String::from_utf8(buf)?;", "            } else {", "                count_empty_lines = 0;", "                if !line.starts_with(\"Content-Length\") {", "                    continue;", "                }", "", "                let tokens: Vec<&str> = line.splitn(2, ':').collect();", "                let len = tokens", "                    .get(1)", "                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?", "                    .trim();", "                content_length = usize::from_str(len)?;", "            }", "        } else if reader.read_line(&mut message)? == 0 {", "            break;", "        }", "", "        let message = message.trim();", "        if message.is_empty() {", "            continue;", "        }", "        debug!(\"<= {:?} {}\", language_id, message);", "        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and", "        // `requestMethod` sent by Sorbet.", "        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let message = serde_json::from_str(&s);", "        if let Err(ref err) = message {", "            error!(", "                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",", "                err, s, err", "            );", "            continue;", "        }", "        // TODO: cleanup.", "        let message = message.unwrap();", "        match message {", "            RawMessage::MethodCall(method_call) => {", "                sink.send(Call::MethodCall(language_id.clone(), method_call))?;", "            }", "            RawMessage::Notification(notification) => {", "                sink.send(Call::Notification(language_id.clone(), notification))?;", "            }", "            RawMessage::Output(output) => {", "                while let Ok((id, tx)) = reader_rx.try_recv() {", "                    pending_outputs.insert(id, tx);", "                }", "", "                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {", "                    tx.send(output)", "                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;", "                }", "            }", "        };", "    }", "", "    info!(\"reader-{:?} terminated\", language_id);", "    Ok(())", "}", "", "fn loop_write(", "    writer: impl Write,", "    rx: &Receiver<RawMessage>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut writer = writer;", "", "    for msg in rx.iter() {", "        let s = serde_json::to_string(&msg)?;", "        debug!(\"=> {:?} {}\", language_id, s);", "        if language_id.is_none() {", "            // Use different convention for two reasons,", "            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim", "            // receives `content`.", "            // 2. Without last line ending, vim output handler won't be triggered.", "            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;", "        } else {", "            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;", "        };", "        writer.flush()?;", "    }", "    Ok(())", "}", "", "#[cfg(test)]", "mod test {", "    use super::RE_REMOVE_EXTRA_FIELDS;", "    use crate::types::RawMessage;", "", "    #[test]", "    // The library we're using for json-rpc doesn't accept extra fields in the structs used to", "    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so", "    // the client fails to deserialize that response.", "    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is", "    // suboptimal, so we now try to remove the extra fields we know of from the response.", "    //", "    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892", "    fn it_should_remove_extra_fields() {", "        // it removes the requestMethod field from Sorbet", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        let message =", "            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        // it removes the meta field from javascript-typescript-langserver", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "    }", "}", ""]}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["s:GetVar('LanguageClient_setOmnifunc', v:true)"],"id":8}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 8, "jsonrpc": "2.0", "result": true}
16:30:46 DEBUG unnamed src/language_client.rs:108 state.text_documents./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> {"languageId":"rust","text":"use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};\nuse anyhow::{anyhow, Result};\nuse crossbeam::channel::{bounded, unbounded, Receiver, Sender};\nuse log::*;\nuse regex::Regex;\nuse serde::{de::DeserializeOwned, Serialize};\nuse std::io::Write;\nuse std::str::FromStr;\nuse std::{\n    collections::HashMap,\n    io::BufRead,\n    sync::atomic::{AtomicU64, Ordering},\n    thread,\n    time::Duration,\n};\n\nconst CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;\n\nlazy_static! {\n    // this regex is used to remove some additional fields that we get from some servers, namely:\n    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.\n    static ref RE_REMOVE_EXTRA_FIELDS: Regex =\n        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();\n}\n\n#[derive(Serialize)]\npub struct RpcClient {\n    language_id: LanguageId,\n    #[serde(skip_serializing)]\n    id: AtomicU64,\n    #[serde(skip_serializing)]\n    writer_tx: Sender<RawMessage>,\n    #[serde(skip_serializing)]\n    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,\n    pub process_id: Option<u32>,\n}\n\nimpl RpcClient {\n    #[allow(clippy::new_ret_no_self)]\n    pub fn new(\n        language_id: LanguageId,\n        reader: impl BufRead + Send + 'static,\n        writer: impl Write + Send + 'static,\n        process_id: Option<u32>,\n        sink: Sender<Call>,\n        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,\n    ) -> Result<Self> {\n        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();\n\n        let language_id_clone = language_id.clone();\n        let reader_thread_name = format!(\"reader-{:?}\", language_id);\n        let on_crash_clone = on_crash.clone();\n        thread::Builder::new()\n            .name(reader_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {\n                            on_crash_clone(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);\n                }\n            })?;\n\n        let (writer_tx, writer_rx) = unbounded();\n        let writer_thread_name = format!(\"writer-{:?}\", language_id);\n        let language_id_clone = language_id.clone();\n        thread::Builder::new()\n            .name(writer_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {\n                            on_crash(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);\n                }\n            })?;\n\n        Ok(Self {\n            language_id,\n            id: AtomicU64::default(),\n            process_id,\n            reader_tx,\n            writer_tx,\n        })\n    }\n\n    pub fn call<R: DeserializeOwned>(\n        &self,\n        method: impl AsRef<str>,\n        params: impl Serialize,\n    ) -> Result<R> {\n        let method = method.as_ref();\n        let id = self.id.fetch_add(1, Ordering::SeqCst);\n        let msg = jsonrpc_core::MethodCall {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            id: jsonrpc_core::Id::Num(id),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        let (tx, rx) = bounded(1);\n        self.reader_tx.send((id, tx))?;\n        self.writer_tx.send(RawMessage::MethodCall(msg))?;\n        // TODO: duration from config.\n        match rx.recv_timeout(Duration::from_secs(60))? {\n            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),\n            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,\n            // which we don't want to show to the user and should ignore, as the result of the\n            // request that triggered this error has been invalidated by changes to the state\n            // of the server, so we must handle this error specifically.\n            jsonrpc_core::Output::Failure(err)\n                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>\n            {\n                Err(anyhow::Error::from(LSError::ContentModified))\n            }\n            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),\n        }\n    }\n\n    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {\n        let method = method.as_ref();\n\n        let msg = jsonrpc_core::Notification {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        self.writer_tx.send(RawMessage::Notification(msg))?;\n        Ok(())\n    }\n\n    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {\n        let output = match result {\n            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                result: serde_json::to_value(ok)?,\n            }),\n            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                error: err.to_rpc_error(),\n            }),\n        };\n\n        self.writer_tx.send(RawMessage::Output(output))?;\n        Ok(())\n    }\n}\n\nfn loop_read(\n    reader: impl BufRead,\n    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,\n    sink: &Sender<Call>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut pending_outputs = HashMap::new();\n\n    // Count how many consequent empty lines.\n    let mut count_empty_lines = 0;\n\n    let mut reader = reader;\n    let mut content_length = 0;\n    loop {\n        let mut message = String::new();\n        let mut line = String::new();\n        if language_id.is_some() {\n            reader.read_line(&mut line)?;\n            let line = line.trim();\n            if line.is_empty() {\n                count_empty_lines += 1;\n                if count_empty_lines > 5 {\n                    return Err(anyhow!(\"Unable to read from language server\"));\n                }\n\n                let mut buf = vec![0; content_length];\n                reader.read_exact(buf.as_mut_slice())?;\n                message = String::from_utf8(buf)?;\n            } else {\n                count_empty_lines = 0;\n                if !line.starts_with(\"Content-Length\") {\n                    continue;\n                }\n\n                let tokens: Vec<&str> = line.splitn(2, ':').collect();\n                let len = tokens\n                    .get(1)\n                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?\n                    .trim();\n                content_length = usize::from_str(len)?;\n            }\n        } else if reader.read_line(&mut message)? == 0 {\n            break;\n        }\n\n        let message = message.trim();\n        if message.is_empty() {\n            continue;\n        }\n        debug!(\"<= {:?} {}\", language_id, message);\n        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and\n        // `requestMethod` sent by Sorbet.\n        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let message = serde_json::from_str(&s);\n        if let Err(ref err) = message {\n            error!(\n                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",\n                err, s, err\n            );\n            continue;\n        }\n        // TODO: cleanup.\n        let message = message.unwrap();\n        match message {\n            RawMessage::MethodCall(method_call) => {\n                sink.send(Call::MethodCall(language_id.clone(), method_call))?;\n            }\n            RawMessage::Notification(notification) => {\n                sink.send(Call::Notification(language_id.clone(), notification))?;\n            }\n            RawMessage::Output(output) => {\n                while let Ok((id, tx)) = reader_rx.try_recv() {\n                    pending_outputs.insert(id, tx);\n                }\n\n                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {\n                    tx.send(output)\n                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;\n                }\n            }\n        };\n    }\n\n    info!(\"reader-{:?} terminated\", language_id);\n    Ok(())\n}\n\nfn loop_write(\n    writer: impl Write,\n    rx: &Receiver<RawMessage>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut writer = writer;\n\n    for msg in rx.iter() {\n        let s = serde_json::to_string(&msg)?;\n        debug!(\"=> {:?} {}\", language_id, s);\n        if language_id.is_none() {\n            // Use different convention for two reasons,\n            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim\n            // receives `content`.\n            // 2. Without last line ending, vim output handler won't be triggered.\n            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;\n        } else {\n            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;\n        };\n        writer.flush()?;\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod test {\n    use super::RE_REMOVE_EXTRA_FIELDS;\n    use crate::types::RawMessage;\n\n    #[test]\n    // The library we're using for json-rpc doesn't accept extra fields in the structs used to\n    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so\n    // the client fails to deserialize that response.\n    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is\n    // suboptimal, so we now try to remove the extra fields we know of from the response.\n    //\n    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892\n    fn it_should_remove_extra_fields() {\n        // it removes the requestMethod field from Sorbet\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        let message =\n            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        // it removes the meta field from javascript-typescript-langserver\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n    }\n}\n","uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs","version":0}
16:30:46 INFO unnamed src/language_server_protocol.rs:1888 text_document_code_lens; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:command","params":["setlocal omnifunc=LanguageClient#complete"]}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};\nuse anyhow::{anyhow, Result};\nuse crossbeam::channel::{bounded, unbounded, Receiver, Sender};\nuse log::*;\nuse regex::Regex;\nuse serde::{de::DeserializeOwned, Serialize};\nuse std::io::Write;\nuse std::str::FromStr;\nuse std::{\n    collections::HashMap,\n    io::BufRead,\n    sync::atomic::{AtomicU64, Ordering},\n    thread,\n    time::Duration,\n};\n\nconst CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;\n\nlazy_static! {\n    // this regex is used to remove some additional fields that we get from some servers, namely:\n    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.\n    static ref RE_REMOVE_EXTRA_FIELDS: Regex =\n        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();\n}\n\n#[derive(Serialize)]\npub struct RpcClient {\n    language_id: LanguageId,\n    #[serde(skip_serializing)]\n    id: AtomicU64,\n    #[serde(skip_serializing)]\n    writer_tx: Sender<RawMessage>,\n    #[serde(skip_serializing)]\n    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,\n    pub process_id: Option<u32>,\n}\n\nimpl RpcClient {\n    #[allow(clippy::new_ret_no_self)]\n    pub fn new(\n        language_id: LanguageId,\n        reader: impl BufRead + Send + 'static,\n        writer: impl Write + Send + 'static,\n        process_id: Option<u32>,\n        sink: Sender<Call>,\n        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,\n    ) -> Result<Self> {\n        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();\n\n        let language_id_clone = language_id.clone();\n        let reader_thread_name = format!(\"reader-{:?}\", language_id);\n        let on_crash_clone = on_crash.clone();\n        thread::Builder::new()\n            .name(reader_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {\n                            on_crash_clone(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);\n                }\n            })?;\n\n        let (writer_tx, writer_rx) = unbounded();\n        let writer_thread_name = format!(\"writer-{:?}\", language_id);\n        let language_id_clone = language_id.clone();\n        thread::Builder::new()\n            .name(writer_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {\n                            on_crash(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);\n                }\n            })?;\n\n        Ok(Self {\n            language_id,\n            id: AtomicU64::default(),\n            process_id,\n            reader_tx,\n            writer_tx,\n        })\n    }\n\n    pub fn call<R: DeserializeOwned>(\n        &self,\n        method: impl AsRef<str>,\n        params: impl Serialize,\n    ) -> Result<R> {\n        let method = method.as_ref();\n        let id = self.id.fetch_add(1, Ordering::SeqCst);\n        let msg = jsonrpc_core::MethodCall {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            id: jsonrpc_core::Id::Num(id),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        let (tx, rx) = bounded(1);\n        self.reader_tx.send((id, tx))?;\n        self.writer_tx.send(RawMessage::MethodCall(msg))?;\n        // TODO: duration from config.\n        match rx.recv_timeout(Duration::from_secs(60))? {\n            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),\n            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,\n            // which we don't want to show to the user and should ignore, as the result of the\n            // request that triggered this error has been invalidated by changes to the state\n            // of the server, so we must handle this error specifically.\n            jsonrpc_core::Output::Failure(err)\n                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>\n            {\n                Err(anyhow::Error::from(LSError::ContentModified))\n            }\n            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),\n        }\n    }\n\n    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {\n        let method = method.as_ref();\n\n        let msg = jsonrpc_core::Notification {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        self.writer_tx.send(RawMessage::Notification(msg))?;\n        Ok(())\n    }\n\n    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {\n        let output = match result {\n            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                result: serde_json::to_value(ok)?,\n            }),\n            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                error: err.to_rpc_error(),\n            }),\n        };\n\n        self.writer_tx.send(RawMessage::Output(output))?;\n        Ok(())\n    }\n}\n\nfn loop_read(\n    reader: impl BufRead,\n    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,\n    sink: &Sender<Call>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut pending_outputs = HashMap::new();\n\n    // Count how many consequent empty lines.\n    let mut count_empty_lines = 0;\n\n    let mut reader = reader;\n    let mut content_length = 0;\n    loop {\n        let mut message = String::new();\n        let mut line = String::new();\n        if language_id.is_some() {\n            reader.read_line(&mut line)?;\n            let line = line.trim();\n            if line.is_empty() {\n                count_empty_lines += 1;\n                if count_empty_lines > 5 {\n                    return Err(anyhow!(\"Unable to read from language server\"));\n                }\n\n                let mut buf = vec![0; content_length];\n                reader.read_exact(buf.as_mut_slice())?;\n                message = String::from_utf8(buf)?;\n            } else {\n                count_empty_lines = 0;\n                if !line.starts_with(\"Content-Length\") {\n                    continue;\n                }\n\n                let tokens: Vec<&str> = line.splitn(2, ':').collect();\n                let len = tokens\n                    .get(1)\n                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?\n                    .trim();\n                content_length = usize::from_str(len)?;\n            }\n        } else if reader.read_line(&mut message)? == 0 {\n            break;\n        }\n\n        let message = message.trim();\n        if message.is_empty() {\n            continue;\n        }\n        debug!(\"<= {:?} {}\", language_id, message);\n        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and\n        // `requestMethod` sent by Sorbet.\n        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let message = serde_json::from_str(&s);\n        if let Err(ref err) = message {\n            error!(\n                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",\n                err, s, err\n            );\n            continue;\n        }\n        // TODO: cleanup.\n        let message = message.unwrap();\n        match message {\n            RawMessage::MethodCall(method_call) => {\n                sink.send(Call::MethodCall(language_id.clone(), method_call))?;\n            }\n            RawMessage::Notification(notification) => {\n                sink.send(Call::Notification(language_id.clone(), notification))?;\n            }\n            RawMessage::Output(output) => {\n                while let Ok((id, tx)) = reader_rx.try_recv() {\n                    pending_outputs.insert(id, tx);\n                }\n\n                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {\n                    tx.send(output)\n                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;\n                }\n            }\n        };\n    }\n\n    info!(\"reader-{:?} terminated\", language_id);\n    Ok(())\n}\n\nfn loop_write(\n    writer: impl Write,\n    rx: &Receiver<RawMessage>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut writer = writer;\n\n    for msg in rx.iter() {\n        let s = serde_json::to_string(&msg)?;\n        debug!(\"=> {:?} {}\", language_id, s);\n        if language_id.is_none() {\n            // Use different convention for two reasons,\n            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim\n            // receives `content`.\n            // 2. Without last line ending, vim output handler won't be triggered.\n            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;\n        } else {\n            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;\n        };\n        writer.flush()?;\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod test {\n    use super::RE_REMOVE_EXTRA_FIELDS;\n    use crate::types::RawMessage;\n\n    #[test]\n    // The library we're using for json-rpc doesn't accept extra fields in the structs used to\n    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so\n    // the client fails to deserialize that response.\n    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is\n    // suboptimal, so we now try to remove the extra fields we know of from the response.\n    //\n    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892\n    fn it_should_remove_extra_fields() {\n        // it removes the requestMethod field from Sorbet\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        let message =\n            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        // it removes the meta field from javascript-typescript-langserver\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n    }\n}\n","uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs","version":0}}}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_projectRoot","/home/dick/LanguageClient-neovim"]}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientTextDocumentDidOpenPost"]}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs"}},"id":1}
16:30:46 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":1,"error":{"code":-32801,"message":"waiting for cargo metadata or cargo check"}}
16:30:47 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":1,"method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]}}
16:30:47 INFO unnamed src/language_server_protocol.rs:2489 client_register_capability; language_id="rust" params=Object({"registrations": Array([Object({"id": String("workspace/didChangeWatchedFiles"), "method": String("workspace/didChangeWatchedFiles"), "registerOptions": Object({"watchers": Array([Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/*.rs")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.toml")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.lock")})])})})])})
16:30:47 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/*.rs
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/mod.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/server_command.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/clangd.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/gopls.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/java.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/mod.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/rust_analyzer.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_client.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_server_protocol.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/logger.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/main.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpcclient.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpchandler.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/sign.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/types.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/utils.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/viewport.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vim.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vimext.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/watcher.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-fa158a1d365cbdd8/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-4457d73fa8da0d46/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-7418c11d7db55b23/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/rls/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/libs.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/main.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.toml
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.toml"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.toml"
16:30:47 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.lock
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.lock"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.lock"
16:30:47 DEBUG unnamed src/language_client.rs:108 state.registrations: [] ==> [{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]
16:30:47 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","result":null,"id":1}
16:30:48 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":2,"method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]}}
16:30:48 INFO unnamed src/language_server_protocol.rs:2489 client_register_capability; language_id="rust" params=Object({"registrations": Array([Object({"id": String("workspace/didChangeWatchedFiles"), "method": String("workspace/didChangeWatchedFiles"), "registerOptions": Object({"watchers": Array([Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/*.rs")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.toml")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.lock")})])})})])})
16:30:48 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/*.rs
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/mod.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/server_command.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/clangd.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/gopls.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/java.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/mod.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/rust_analyzer.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_client.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_server_protocol.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/logger.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/main.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpcclient.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpchandler.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/sign.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/types.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/utils.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/viewport.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vim.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vimext.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/watcher.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-fa158a1d365cbdd8/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-4457d73fa8da0d46/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-7418c11d7db55b23/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/rls/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/libs.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/main.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.toml
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.toml"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.toml"
16:30:48 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.lock
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.lock"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.lock"
16:30:48 DEBUG unnamed src/language_client.rs:108 state.registrations: [{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}] ==> [{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}},{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]
16:30:48 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","result":null,"id":2}
16:31:04 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs","diagnostics":[],"version":0}}
16:31:04 INFO unnamed src/language_server_protocol.rs:2095 text_document_publish_diagnostics; params=Object({"diagnostics": Array([]), "uri": String("file:///home/dick/LanguageClient-neovim/src/rpcclient.rs"), "version": Number(0)})
16:31:04 DEBUG unnamed src/language_client.rs:108 state.diagnostics./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> []
16:31:04 INFO unnamed src/vim.rs:225 Begin setqflist
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setqflist","params":[[],"r"]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setqflist","params":[[],"a",{"title":"[LC]: diagnostics"}]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["bufnr('/home/dick/LanguageClient-neovim/src/rpcclient.rs')"],"id":9}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 9, "jsonrpc": "2.0", "result": 1}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_statusLineDiagnosticsCounts",{"E":0,"H":0,"I":0,"W":0}]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":10}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 10, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:31:04 DEBUG unnamed src/language_client.rs:108 state.highlights./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> []
16:31:04 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Null force_redraw=true
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":11}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 11, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"getbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","&filetype"],"id":12}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 12, "jsonrpc": "2.0", "result": "rust"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#position()"],"id":13}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 13, "jsonrpc": "2.0", "result": {"character": 0, "line": 0}}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#viewport()"],"id":14}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 14, "jsonrpc": "2.0", "result": {"end": 20, "start": 0}}
16:31:04 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 0, end: 20 }
16:31:04 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> {"end":20,"start":0}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":15}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 15, "jsonrpc": "2.0", "result": 0}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":16}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 16, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#viewport()"],"id":17}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 17, "jsonrpc": "2.0", "result": {"end": 20, "start": 0}}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["bufnr('/home/dick/LanguageClient-neovim/src/rpcclient.rs')"],"id":18}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 18, "jsonrpc": "2.0", "result": 1}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"nvim_create_namespace","params":["LanguageClient_VirtualText"],"id":19}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 19, "jsonrpc": "2.0", "result": 3}
16:31:04 DEBUG unnamed src/language_client.rs:108 state.namespace_ids.LanguageClient_VirtualText: null ==> 3
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":20}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 20, "jsonrpc": "2.0", "result": "c"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,0,20,[]],"id":21}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 21, "jsonrpc": "2.0", "result": 0}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientDiagnosticsChanged"]}
17:00:02 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 20, "start": 0}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 1}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:00:02 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(1)}), "viewport": Object({"end": Number(20), "start": Number(0)})}) force_redraw=false
17:00:02 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:EchoEllipsis","params":[""]}
17:00:02 DEBUG unnamed src/language_client.rs:108 state.last_line_diagnostic: " " ==> ""
17:00:02 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 0 ==> 1
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 24, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:00:03 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(24), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:00:03 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 1 ==> 49
17:00:03 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 40, end: 59 }
17:00:03 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.start: 0 ==> 40
17:00:03 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.end: 20 ==> 59
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":22}
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 22, "jsonrpc": "2.0", "result": 0}
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":23}
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 23, "jsonrpc": "2.0", "result": "n"}
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,40,59,[]],"id":24}
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 24, "jsonrpc": "2.0", "result": 0}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 1, "jsonrpc": "2.0", "method": "textDocument/definition", "params": {"bufnr": 1, "character": 45, "handle": true, "languageId": "rust", "gotoCmd": null, "line": 49, "text": ["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};", "use anyhow::{anyhow, Result};", "use crossbeam::channel::{bounded, unbounded, Receiver, Sender};", "use log::*;", "use regex::Regex;", "use serde::{de::DeserializeOwned, Serialize};", "use std::io::Write;", "use std::str::FromStr;", "use std::{", "    collections::HashMap,", "    io::BufRead,", "    sync::atomic::{AtomicU64, Ordering},", "    thread,", "    time::Duration,", "};", "", "const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;", "", "lazy_static! {", "    // this regex is used to remove some additional fields that we get from some servers, namely:", "    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.", "    static ref RE_REMOVE_EXTRA_FIELDS: Regex =", "        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();", "}", "", "#[derive(Serialize)]", "pub struct RpcClient {", "    language_id: LanguageId,", "    #[serde(skip_serializing)]", "    id: AtomicU64,", "    #[serde(skip_serializing)]", "    writer_tx: Sender<RawMessage>,", "    #[serde(skip_serializing)]", "    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,", "    pub process_id: Option<u32>,", "}", "", "impl RpcClient {", "    #[allow(clippy::new_ret_no_self)]", "    pub fn new(", "        language_id: LanguageId,", "        reader: impl BufRead + Send + 'static,", "        writer: impl Write + Send + 'static,", "        process_id: Option<u32>,", "        sink: Sender<Call>,", "        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,", "    ) -> Result<Self> {", "        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();", "", "        let language_id_clone = language_id.clone();", "        let reader_thread_name = format!(\"reader-{:?}\", language_id);", "        let on_crash_clone = on_crash.clone();", "        thread::Builder::new()", "            .name(reader_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {", "                            on_crash_clone(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);", "                }", "            })?;", "", "        let (writer_tx, writer_rx) = unbounded();", "        let writer_thread_name = format!(\"writer-{:?}\", language_id);", "        let language_id_clone = language_id.clone();", "        thread::Builder::new()", "            .name(writer_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {", "                            on_crash(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);", "                }", "            })?;", "", "        Ok(Self {", "            language_id,", "            id: AtomicU64::default(),", "            process_id,", "            reader_tx,", "            writer_tx,", "        })", "    }", "", "    pub fn call<R: DeserializeOwned>(", "        &self,", "        method: impl AsRef<str>,", "        params: impl Serialize,", "    ) -> Result<R> {", "        let method = method.as_ref();", "        let id = self.id.fetch_add(1, Ordering::SeqCst);", "        let msg = jsonrpc_core::MethodCall {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            id: jsonrpc_core::Id::Num(id),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        let (tx, rx) = bounded(1);", "        self.reader_tx.send((id, tx))?;", "        self.writer_tx.send(RawMessage::MethodCall(msg))?;", "        // TODO: duration from config.", "        match rx.recv_timeout(Duration::from_secs(60))? {", "            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),", "            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,", "            // which we don't want to show to the user and should ignore, as the result of the", "            // request that triggered this error has been invalidated by changes to the state", "            // of the server, so we must handle this error specifically.", "            jsonrpc_core::Output::Failure(err)", "                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>", "            {", "                Err(anyhow::Error::from(LSError::ContentModified))", "            }", "            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),", "        }", "    }", "", "    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {", "        let method = method.as_ref();", "", "        let msg = jsonrpc_core::Notification {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        self.writer_tx.send(RawMessage::Notification(msg))?;", "        Ok(())", "    }", "", "    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {", "        let output = match result {", "            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                result: serde_json::to_value(ok)?,", "            }),", "            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                error: err.to_rpc_error(),", "            }),", "        };", "", "        self.writer_tx.send(RawMessage::Output(output))?;", "        Ok(())", "    }", "}", "", "fn loop_read(", "    reader: impl BufRead,", "    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,", "    sink: &Sender<Call>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut pending_outputs = HashMap::new();", "", "    // Count how many consequent empty lines.", "    let mut count_empty_lines = 0;", "", "    let mut reader = reader;", "    let mut content_length = 0;", "    loop {", "        let mut message = String::new();", "        let mut line = String::new();", "        if language_id.is_some() {", "            reader.read_line(&mut line)?;", "            let line = line.trim();", "            if line.is_empty() {", "                count_empty_lines += 1;", "                if count_empty_lines > 5 {", "                    return Err(anyhow!(\"Unable to read from language server\"));", "                }", "", "                let mut buf = vec![0; content_length];", "                reader.read_exact(buf.as_mut_slice())?;", "                message = String::from_utf8(buf)?;", "            } else {", "                count_empty_lines = 0;", "                if !line.starts_with(\"Content-Length\") {", "                    continue;", "                }", "", "                let tokens: Vec<&str> = line.splitn(2, ':').collect();", "                let len = tokens", "                    .get(1)", "                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?", "                    .trim();", "                content_length = usize::from_str(len)?;", "            }", "        } else if reader.read_line(&mut message)? == 0 {", "            break;", "        }", "", "        let message = message.trim();", "        if message.is_empty() {", "            continue;", "        }", "        debug!(\"<= {:?} {}\", language_id, message);", "        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and", "        // `requestMethod` sent by Sorbet.", "        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let message = serde_json::from_str(&s);", "        if let Err(ref err) = message {", "            error!(", "                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",", "                err, s, err", "            );", "            continue;", "        }", "        // TODO: cleanup.", "        let message = message.unwrap();", "        match message {", "            RawMessage::MethodCall(method_call) => {", "                sink.send(Call::MethodCall(language_id.clone(), method_call))?;", "            }", "            RawMessage::Notification(notification) => {", "                sink.send(Call::Notification(language_id.clone(), notification))?;", "            }", "            RawMessage::Output(output) => {", "                while let Ok((id, tx)) = reader_rx.try_recv() {", "                    pending_outputs.insert(id, tx);", "                }", "", "                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {", "                    tx.send(output)", "                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;", "                }", "            }", "        };", "    }", "", "    info!(\"reader-{:?} terminated\", language_id);", "    Ok(())", "}", "", "fn loop_write(", "    writer: impl Write,", "    rx: &Receiver<RawMessage>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut writer = writer;", "", "    for msg in rx.iter() {", "        let s = serde_json::to_string(&msg)?;", "        debug!(\"=> {:?} {}\", language_id, s);", "        if language_id.is_none() {", "            // Use different convention for two reasons,", "            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim", "            // receives `content`.", "            // 2. Without last line ending, vim output handler won't be triggered.", "            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;", "        } else {", "            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;", "        };", "        writer.flush()?;", "    }", "    Ok(())", "}", "", "#[cfg(test)]", "mod test {", "    use super::RE_REMOVE_EXTRA_FIELDS;", "    use crate::types::RawMessage;", "", "    #[test]", "    // The library we're using for json-rpc doesn't accept extra fields in the structs used to", "    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so", "    // the client fails to deserialize that response.", "    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is", "    // suboptimal, so we now try to remove the extra fields we know of from the response.", "    //", "    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892", "    fn it_should_remove_extra_fields() {", "        // it removes the requestMethod field from Sorbet", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        let message =", "            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        // it removes the meta field from javascript-typescript-langserver", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "    }", "}", ""], "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:1473 text_document_definition; params=Object({"bufnr": Number(1), "character": Number(45), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "gotoCmd": Null, "handle": Bool(true), "languageId": String("rust"), "line": Number(49), "text": Array([String("use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};"), String("use anyhow::{anyhow, Result};"), String("use crossbeam::channel::{bounded, unbounded, Receiver, Sender};"), String("use log::*;"), String("use regex::Regex;"), String("use serde::{de::DeserializeOwned, Serialize};"), String("use std::io::Write;"), String("use std::str::FromStr;"), String("use std::{"), String("    collections::HashMap,"), String("    io::BufRead,"), String("    sync::atomic::{AtomicU64, Ordering},"), String("    thread,"), String("    time::Duration,"), String("};"), String(""), String("const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;"), String(""), String("lazy_static! {"), String("    // this regex is used to remove some additional fields that we get from some servers, namely:"), String("    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet."), String("    static ref RE_REMOVE_EXTRA_FIELDS: Regex ="), String("        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();"), String("}"), String(""), String("#[derive(Serialize)]"), String("pub struct RpcClient {"), String("    language_id: LanguageId,"), String("    #[serde(skip_serializing)]"), String("    id: AtomicU64,"), String("    #[serde(skip_serializing)]"), String("    writer_tx: Sender<RawMessage>,"), String("    #[serde(skip_serializing)]"), String("    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,"), String("    pub process_id: Option<u32>,"), String("}"), String(""), String("impl RpcClient {"), String("    #[allow(clippy::new_ret_no_self)]"), String("    pub fn new("), String("        language_id: LanguageId,"), String("        reader: impl BufRead + Send + 'static,"), String("        writer: impl Write + Send + 'static,"), String("        process_id: Option<u32>,"), String("        sink: Sender<Call>,"), String("        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,"), String("    ) -> Result<Self> {"), String("        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();"), String(""), String("        let language_id_clone = language_id.clone();"), String("        let reader_thread_name = format!(\"reader-{:?}\", language_id);"), String("        let on_crash_clone = on_crash.clone();"), String("        thread::Builder::new()"), String("            .name(reader_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {"), String("                            on_crash_clone(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        let (writer_tx, writer_rx) = unbounded();"), String("        let writer_thread_name = format!(\"writer-{:?}\", language_id);"), String("        let language_id_clone = language_id.clone();"), String("        thread::Builder::new()"), String("            .name(writer_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {"), String("                            on_crash(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        Ok(Self {"), String("            language_id,"), String("            id: AtomicU64::default(),"), String("            process_id,"), String("            reader_tx,"), String("            writer_tx,"), String("        })"), String("    }"), String(""), String("    pub fn call<R: DeserializeOwned>("), String("        &self,"), String("        method: impl AsRef<str>,"), String("        params: impl Serialize,"), String("    ) -> Result<R> {"), String("        let method = method.as_ref();"), String("        let id = self.id.fetch_add(1, Ordering::SeqCst);"), String("        let msg = jsonrpc_core::MethodCall {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            id: jsonrpc_core::Id::Num(id),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        let (tx, rx) = bounded(1);"), String("        self.reader_tx.send((id, tx))?;"), String("        self.writer_tx.send(RawMessage::MethodCall(msg))?;"), String("        // TODO: duration from config."), String("        match rx.recv_timeout(Duration::from_secs(60))? {"), String("            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),"), String("            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,"), String("            // which we don't want to show to the user and should ignore, as the result of the"), String("            // request that triggered this error has been invalidated by changes to the state"), String("            // of the server, so we must handle this error specifically."), String("            jsonrpc_core::Output::Failure(err)"), String("                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>"), String("            {"), String("                Err(anyhow::Error::from(LSError::ContentModified))"), String("            }"), String("            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),"), String("        }"), String("    }"), String(""), String("    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {"), String("        let method = method.as_ref();"), String(""), String("        let msg = jsonrpc_core::Notification {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        self.writer_tx.send(RawMessage::Notification(msg))?;"), String("        Ok(())"), String("    }"), String(""), String("    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {"), String("        let output = match result {"), String("            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                result: serde_json::to_value(ok)?,"), String("            }),"), String("            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                error: err.to_rpc_error(),"), String("            }),"), String("        };"), String(""), String("        self.writer_tx.send(RawMessage::Output(output))?;"), String("        Ok(())"), String("    }"), String("}"), String(""), String("fn loop_read("), String("    reader: impl BufRead,"), String("    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,"), String("    sink: &Sender<Call>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut pending_outputs = HashMap::new();"), String(""), String("    // Count how many consequent empty lines."), String("    let mut count_empty_lines = 0;"), String(""), String("    let mut reader = reader;"), String("    let mut content_length = 0;"), String("    loop {"), String("        let mut message = String::new();"), String("        let mut line = String::new();"), String("        if language_id.is_some() {"), String("            reader.read_line(&mut line)?;"), String("            let line = line.trim();"), String("            if line.is_empty() {"), String("                count_empty_lines += 1;"), String("                if count_empty_lines > 5 {"), String("                    return Err(anyhow!(\"Unable to read from language server\"));"), String("                }"), String(""), String("                let mut buf = vec![0; content_length];"), String("                reader.read_exact(buf.as_mut_slice())?;"), String("                message = String::from_utf8(buf)?;"), String("            } else {"), String("                count_empty_lines = 0;"), String("                if !line.starts_with(\"Content-Length\") {"), String("                    continue;"), String("                }"), String(""), String("                let tokens: Vec<&str> = line.splitn(2, ':').collect();"), String("                let len = tokens"), String("                    .get(1)"), String("                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?"), String("                    .trim();"), String("                content_length = usize::from_str(len)?;"), String("            }"), String("        } else if reader.read_line(&mut message)? == 0 {"), String("            break;"), String("        }"), String(""), String("        let message = message.trim();"), String("        if message.is_empty() {"), String("            continue;"), String("        }"), String("        debug!(\"<= {:?} {}\", language_id, message);"), String("        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and"), String("        // `requestMethod` sent by Sorbet."), String("        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let message = serde_json::from_str(&s);"), String("        if let Err(ref err) = message {"), String("            error!("), String("                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\","), String("                err, s, err"), String("            );"), String("            continue;"), String("        }"), String("        // TODO: cleanup."), String("        let message = message.unwrap();"), String("        match message {"), String("            RawMessage::MethodCall(method_call) => {"), String("                sink.send(Call::MethodCall(language_id.clone(), method_call))?;"), String("            }"), String("            RawMessage::Notification(notification) => {"), String("                sink.send(Call::Notification(language_id.clone(), notification))?;"), String("            }"), String("            RawMessage::Output(output) => {"), String("                while let Ok((id, tx)) = reader_rx.try_recv() {"), String("                    pending_outputs.insert(id, tx);"), String("                }"), String(""), String("                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {"), String("                    tx.send(output)"), String("                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;"), String("                }"), String("            }"), String("        };"), String("    }"), String(""), String("    info!(\"reader-{:?} terminated\", language_id);"), String("    Ok(())"), String("}"), String(""), String("fn loop_write("), String("    writer: impl Write,"), String("    rx: &Receiver<RawMessage>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut writer = writer;"), String(""), String("    for msg in rx.iter() {"), String("        let s = serde_json::to_string(&msg)?;"), String("        debug!(\"=> {:?} {}\", language_id, s);"), String("        if language_id.is_none() {"), String("            // Use different convention for two reasons,"), String("            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim"), String("            // receives `content`."), String("            // 2. Without last line ending, vim output handler won't be triggered."), String("            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;"), String("        } else {"), String("            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;"), String("        };"), String("        writer.flush()?;"), String("    }"), String("    Ok(())"), String("}"), String(""), String("#[cfg(test)]"), String("mod test {"), String("    use super::RE_REMOVE_EXTRA_FIELDS;"), String("    use crate::types::RawMessage;"), String(""), String("    #[test]"), String("    // The library we're using for json-rpc doesn't accept extra fields in the structs used to"), String("    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so"), String("    // the client fails to deserialize that response."), String("    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is"), String("    // suboptimal, so we now try to remove the extra fields we know of from the response."), String("    //"), String("    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892"), String("    fn it_should_remove_extra_fields() {"), String("        // it removes the requestMethod field from Sorbet"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        let message ="), String("            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        // it removes the meta field from javascript-typescript-langserver"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String("    }"), String("}"), String("")])})
17:00:16 INFO unnamed src/language_server_protocol.rs:1077 find_locations; params=Object({"bufnr": Number(1), "character": Number(45), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "gotoCmd": Null, "handle": Bool(true), "languageId": String("rust"), "line": Number(49), "method": String("textDocument/definition"), "text": Array([String("use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};"), String("use anyhow::{anyhow, Result};"), String("use crossbeam::channel::{bounded, unbounded, Receiver, Sender};"), String("use log::*;"), String("use regex::Regex;"), String("use serde::{de::DeserializeOwned, Serialize};"), String("use std::io::Write;"), String("use std::str::FromStr;"), String("use std::{"), String("    collections::HashMap,"), String("    io::BufRead,"), String("    sync::atomic::{AtomicU64, Ordering},"), String("    thread,"), String("    time::Duration,"), String("};"), String(""), String("const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;"), String(""), String("lazy_static! {"), String("    // this regex is used to remove some additional fields that we get from some servers, namely:"), String("    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet."), String("    static ref RE_REMOVE_EXTRA_FIELDS: Regex ="), String("        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();"), String("}"), String(""), String("#[derive(Serialize)]"), String("pub struct RpcClient {"), String("    language_id: LanguageId,"), String("    #[serde(skip_serializing)]"), String("    id: AtomicU64,"), String("    #[serde(skip_serializing)]"), String("    writer_tx: Sender<RawMessage>,"), String("    #[serde(skip_serializing)]"), String("    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,"), String("    pub process_id: Option<u32>,"), String("}"), String(""), String("impl RpcClient {"), String("    #[allow(clippy::new_ret_no_self)]"), String("    pub fn new("), String("        language_id: LanguageId,"), String("        reader: impl BufRead + Send + 'static,"), String("        writer: impl Write + Send + 'static,"), String("        process_id: Option<u32>,"), String("        sink: Sender<Call>,"), String("        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,"), String("    ) -> Result<Self> {"), String("        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();"), String(""), String("        let language_id_clone = language_id.clone();"), String("        let reader_thread_name = format!(\"reader-{:?}\", language_id);"), String("        let on_crash_clone = on_crash.clone();"), String("        thread::Builder::new()"), String("            .name(reader_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {"), String("                            on_crash_clone(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        let (writer_tx, writer_rx) = unbounded();"), String("        let writer_thread_name = format!(\"writer-{:?}\", language_id);"), String("        let language_id_clone = language_id.clone();"), String("        thread::Builder::new()"), String("            .name(writer_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {"), String("                            on_crash(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        Ok(Self {"), String("            language_id,"), String("            id: AtomicU64::default(),"), String("            process_id,"), String("            reader_tx,"), String("            writer_tx,"), String("        })"), String("    }"), String(""), String("    pub fn call<R: DeserializeOwned>("), String("        &self,"), String("        method: impl AsRef<str>,"), String("        params: impl Serialize,"), String("    ) -> Result<R> {"), String("        let method = method.as_ref();"), String("        let id = self.id.fetch_add(1, Ordering::SeqCst);"), String("        let msg = jsonrpc_core::MethodCall {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            id: jsonrpc_core::Id::Num(id),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        let (tx, rx) = bounded(1);"), String("        self.reader_tx.send((id, tx))?;"), String("        self.writer_tx.send(RawMessage::MethodCall(msg))?;"), String("        // TODO: duration from config."), String("        match rx.recv_timeout(Duration::from_secs(60))? {"), String("            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),"), String("            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,"), String("            // which we don't want to show to the user and should ignore, as the result of the"), String("            // request that triggered this error has been invalidated by changes to the state"), String("            // of the server, so we must handle this error specifically."), String("            jsonrpc_core::Output::Failure(err)"), String("                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>"), String("            {"), String("                Err(anyhow::Error::from(LSError::ContentModified))"), String("            }"), String("            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),"), String("        }"), String("    }"), String(""), String("    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {"), String("        let method = method.as_ref();"), String(""), String("        let msg = jsonrpc_core::Notification {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        self.writer_tx.send(RawMessage::Notification(msg))?;"), String("        Ok(())"), String("    }"), String(""), String("    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {"), String("        let output = match result {"), String("            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                result: serde_json::to_value(ok)?,"), String("            }),"), String("            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                error: err.to_rpc_error(),"), String("            }),"), String("        };"), String(""), String("        self.writer_tx.send(RawMessage::Output(output))?;"), String("        Ok(())"), String("    }"), String("}"), String(""), String("fn loop_read("), String("    reader: impl BufRead,"), String("    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,"), String("    sink: &Sender<Call>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut pending_outputs = HashMap::new();"), String(""), String("    // Count how many consequent empty lines."), String("    let mut count_empty_lines = 0;"), String(""), String("    let mut reader = reader;"), String("    let mut content_length = 0;"), String("    loop {"), String("        let mut message = String::new();"), String("        let mut line = String::new();"), String("        if language_id.is_some() {"), String("            reader.read_line(&mut line)?;"), String("            let line = line.trim();"), String("            if line.is_empty() {"), String("                count_empty_lines += 1;"), String("                if count_empty_lines > 5 {"), String("                    return Err(anyhow!(\"Unable to read from language server\"));"), String("                }"), String(""), String("                let mut buf = vec![0; content_length];"), String("                reader.read_exact(buf.as_mut_slice())?;"), String("                message = String::from_utf8(buf)?;"), String("            } else {"), String("                count_empty_lines = 0;"), String("                if !line.starts_with(\"Content-Length\") {"), String("                    continue;"), String("                }"), String(""), String("                let tokens: Vec<&str> = line.splitn(2, ':').collect();"), String("                let len = tokens"), String("                    .get(1)"), String("                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?"), String("                    .trim();"), String("                content_length = usize::from_str(len)?;"), String("            }"), String("        } else if reader.read_line(&mut message)? == 0 {"), String("            break;"), String("        }"), String(""), String("        let message = message.trim();"), String("        if message.is_empty() {"), String("            continue;"), String("        }"), String("        debug!(\"<= {:?} {}\", language_id, message);"), String("        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and"), String("        // `requestMethod` sent by Sorbet."), String("        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let message = serde_json::from_str(&s);"), String("        if let Err(ref err) = message {"), String("            error!("), String("                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\","), String("                err, s, err"), String("            );"), String("            continue;"), String("        }"), String("        // TODO: cleanup."), String("        let message = message.unwrap();"), String("        match message {"), String("            RawMessage::MethodCall(method_call) => {"), String("                sink.send(Call::MethodCall(language_id.clone(), method_call))?;"), String("            }"), String("            RawMessage::Notification(notification) => {"), String("                sink.send(Call::Notification(language_id.clone(), notification))?;"), String("            }"), String("            RawMessage::Output(output) => {"), String("                while let Ok((id, tx)) = reader_rx.try_recv() {"), String("                    pending_outputs.insert(id, tx);"), String("                }"), String(""), String("                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {"), String("                    tx.send(output)"), String("                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;"), String("                }"), String("            }"), String("        };"), String("    }"), String(""), String("    info!(\"reader-{:?} terminated\", language_id);"), String("    Ok(())"), String("}"), String(""), String("fn loop_write("), String("    writer: impl Write,"), String("    rx: &Receiver<RawMessage>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut writer = writer;"), String(""), String("    for msg in rx.iter() {"), String("        let s = serde_json::to_string(&msg)?;"), String("        debug!(\"=> {:?} {}\", language_id, s);"), String("        if language_id.is_none() {"), String("            // Use different convention for two reasons,"), String("            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim"), String("            // receives `content`."), String("            // 2. Without last line ending, vim output handler won't be triggered."), String("            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;"), String("        } else {"), String("            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;"), String("        };"), String("        writer.flush()?;"), String("    }"), String("    Ok(())"), String("}"), String(""), String("#[cfg(test)]"), String("mod test {"), String("    use super::RE_REMOVE_EXTRA_FIELDS;"), String("    use crate::types::RawMessage;"), String(""), String("    #[test]"), String("    // The library we're using for json-rpc doesn't accept extra fields in the structs used to"), String("    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so"), String("    // the client fails to deserialize that response."), String("    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is"), String("    // suboptimal, so we now try to remove the extra fields we know of from the response."), String("    //"), String("    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892"), String("    fn it_should_remove_extra_fields() {"), String("        // it removes the requestMethod field from Sorbet"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        let message ="), String("            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        // it removes the meta field from javascript-typescript-langserver"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String("    }"), String("}"), String("")])})
17:00:16 INFO unnamed src/language_server_protocol.rs:1993 text_document_did_change; params=Object({"bufnr": Number(1), "character": Number(45), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "gotoCmd": Null, "handle": Bool(true), "languageId": String("rust"), "line": Number(49), "method": String("textDocument/definition"), "text": Array([String("use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};"), String("use anyhow::{anyhow, Result};"), String("use crossbeam::channel::{bounded, unbounded, Receiver, Sender};"), String("use log::*;"), String("use regex::Regex;"), String("use serde::{de::DeserializeOwned, Serialize};"), String("use std::io::Write;"), String("use std::str::FromStr;"), String("use std::{"), String("    collections::HashMap,"), String("    io::BufRead,"), String("    sync::atomic::{AtomicU64, Ordering},"), String("    thread,"), String("    time::Duration,"), String("};"), String(""), String("const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;"), String(""), String("lazy_static! {"), String("    // this regex is used to remove some additional fields that we get from some servers, namely:"), String("    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet."), String("    static ref RE_REMOVE_EXTRA_FIELDS: Regex ="), String("        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();"), String("}"), String(""), String("#[derive(Serialize)]"), String("pub struct RpcClient {"), String("    language_id: LanguageId,"), String("    #[serde(skip_serializing)]"), String("    id: AtomicU64,"), String("    #[serde(skip_serializing)]"), String("    writer_tx: Sender<RawMessage>,"), String("    #[serde(skip_serializing)]"), String("    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,"), String("    pub process_id: Option<u32>,"), String("}"), String(""), String("impl RpcClient {"), String("    #[allow(clippy::new_ret_no_self)]"), String("    pub fn new("), String("        language_id: LanguageId,"), String("        reader: impl BufRead + Send + 'static,"), String("        writer: impl Write + Send + 'static,"), String("        process_id: Option<u32>,"), String("        sink: Sender<Call>,"), String("        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,"), String("    ) -> Result<Self> {"), String("        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();"), String(""), String("        let language_id_clone = language_id.clone();"), String("        let reader_thread_name = format!(\"reader-{:?}\", language_id);"), String("        let on_crash_clone = on_crash.clone();"), String("        thread::Builder::new()"), String("            .name(reader_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {"), String("                            on_crash_clone(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        let (writer_tx, writer_rx) = unbounded();"), String("        let writer_thread_name = format!(\"writer-{:?}\", language_id);"), String("        let language_id_clone = language_id.clone();"), String("        thread::Builder::new()"), String("            .name(writer_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {"), String("                            on_crash(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        Ok(Self {"), String("            language_id,"), String("            id: AtomicU64::default(),"), String("            process_id,"), String("            reader_tx,"), String("            writer_tx,"), String("        })"), String("    }"), String(""), String("    pub fn call<R: DeserializeOwned>("), String("        &self,"), String("        method: impl AsRef<str>,"), String("        params: impl Serialize,"), String("    ) -> Result<R> {"), String("        let method = method.as_ref();"), String("        let id = self.id.fetch_add(1, Ordering::SeqCst);"), String("        let msg = jsonrpc_core::MethodCall {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            id: jsonrpc_core::Id::Num(id),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        let (tx, rx) = bounded(1);"), String("        self.reader_tx.send((id, tx))?;"), String("        self.writer_tx.send(RawMessage::MethodCall(msg))?;"), String("        // TODO: duration from config."), String("        match rx.recv_timeout(Duration::from_secs(60))? {"), String("            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),"), String("            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,"), String("            // which we don't want to show to the user and should ignore, as the result of the"), String("            // request that triggered this error has been invalidated by changes to the state"), String("            // of the server, so we must handle this error specifically."), String("            jsonrpc_core::Output::Failure(err)"), String("                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>"), String("            {"), String("                Err(anyhow::Error::from(LSError::ContentModified))"), String("            }"), String("            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),"), String("        }"), String("    }"), String(""), String("    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {"), String("        let method = method.as_ref();"), String(""), String("        let msg = jsonrpc_core::Notification {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        self.writer_tx.send(RawMessage::Notification(msg))?;"), String("        Ok(())"), String("    }"), String(""), String("    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {"), String("        let output = match result {"), String("            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                result: serde_json::to_value(ok)?,"), String("            }),"), String("            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                error: err.to_rpc_error(),"), String("            }),"), String("        };"), String(""), String("        self.writer_tx.send(RawMessage::Output(output))?;"), String("        Ok(())"), String("    }"), String("}"), String(""), String("fn loop_read("), String("    reader: impl BufRead,"), String("    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,"), String("    sink: &Sender<Call>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut pending_outputs = HashMap::new();"), String(""), String("    // Count how many consequent empty lines."), String("    let mut count_empty_lines = 0;"), String(""), String("    let mut reader = reader;"), String("    let mut content_length = 0;"), String("    loop {"), String("        let mut message = String::new();"), String("        let mut line = String::new();"), String("        if language_id.is_some() {"), String("            reader.read_line(&mut line)?;"), String("            let line = line.trim();"), String("            if line.is_empty() {"), String("                count_empty_lines += 1;"), String("                if count_empty_lines > 5 {"), String("                    return Err(anyhow!(\"Unable to read from language server\"));"), String("                }"), String(""), String("                let mut buf = vec![0; content_length];"), String("                reader.read_exact(buf.as_mut_slice())?;"), String("                message = String::from_utf8(buf)?;"), String("            } else {"), String("                count_empty_lines = 0;"), String("                if !line.starts_with(\"Content-Length\") {"), String("                    continue;"), String("                }"), String(""), String("                let tokens: Vec<&str> = line.splitn(2, ':').collect();"), String("                let len = tokens"), String("                    .get(1)"), String("                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?"), String("                    .trim();"), String("                content_length = usize::from_str(len)?;"), String("            }"), String("        } else if reader.read_line(&mut message)? == 0 {"), String("            break;"), String("        }"), String(""), String("        let message = message.trim();"), String("        if message.is_empty() {"), String("            continue;"), String("        }"), String("        debug!(\"<= {:?} {}\", language_id, message);"), String("        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and"), String("        // `requestMethod` sent by Sorbet."), String("        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let message = serde_json::from_str(&s);"), String("        if let Err(ref err) = message {"), String("            error!("), String("                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\","), String("                err, s, err"), String("            );"), String("            continue;"), String("        }"), String("        // TODO: cleanup."), String("        let message = message.unwrap();"), String("        match message {"), String("            RawMessage::MethodCall(method_call) => {"), String("                sink.send(Call::MethodCall(language_id.clone(), method_call))?;"), String("            }"), String("            RawMessage::Notification(notification) => {"), String("                sink.send(Call::Notification(language_id.clone(), notification))?;"), String("            }"), String("            RawMessage::Output(output) => {"), String("                while let Ok((id, tx)) = reader_rx.try_recv() {"), String("                    pending_outputs.insert(id, tx);"), String("                }"), String(""), String("                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {"), String("                    tx.send(output)"), String("                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;"), String("                }"), String("            }"), String("        };"), String("    }"), String(""), String("    info!(\"reader-{:?} terminated\", language_id);"), String("    Ok(())"), String("}"), String(""), String("fn loop_write("), String("    writer: impl Write,"), String("    rx: &Receiver<RawMessage>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut writer = writer;"), String(""), String("    for msg in rx.iter() {"), String("        let s = serde_json::to_string(&msg)?;"), String("        debug!(\"=> {:?} {}\", language_id, s);"), String("        if language_id.is_none() {"), String("            // Use different convention for two reasons,"), String("            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim"), String("            // receives `content`."), String("            // 2. Without last line ending, vim output handler won't be triggered."), String("            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;"), String("        } else {"), String("            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;"), String("        };"), String("        writer.flush()?;"), String("    }"), String("    Ok(())"), String("}"), String(""), String("#[cfg(test)]"), String("mod test {"), String("    use super::RE_REMOVE_EXTRA_FIELDS;"), String("    use crate::types::RawMessage;"), String(""), String("    #[test]"), String("    // The library we're using for json-rpc doesn't accept extra fields in the structs used to"), String("    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so"), String("    // the client fails to deserialize that response."), String("    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is"), String("    // suboptimal, so we now try to remove the extra fields we know of from the response."), String("    //"), String("    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892"), String("    fn it_should_remove_extra_fields() {"), String("        // it removes the requestMethod field from Sorbet"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        let message ="), String("            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        // it removes the meta field from javascript-typescript-langserver"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String("    }"), String("}"), String("")])})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"LSP#text","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs"],"id":25}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 25, "jsonrpc": "2.0", "result": ["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};", "use anyhow::{anyhow, Result};", "use crossbeam::channel::{bounded, unbounded, Receiver, Sender};", "use log::*;", "use regex::Regex;", "use serde::{de::DeserializeOwned, Serialize};", "use std::io::Write;", "use std::str::FromStr;", "use std::{", "    collections::HashMap,", "    io::BufRead,", "    sync::atomic::{AtomicU64, Ordering},", "    thread,", "    time::Duration,", "};", "", "const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;", "", "lazy_static! {", "    // this regex is used to remove some additional fields that we get from some servers, namely:", "    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.", "    static ref RE_REMOVE_EXTRA_FIELDS: Regex =", "        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();", "}", "", "#[derive(Serialize)]", "pub struct RpcClient {", "    language_id: LanguageId,", "    #[serde(skip_serializing)]", "    id: AtomicU64,", "    #[serde(skip_serializing)]", "    writer_tx: Sender<RawMessage>,", "    #[serde(skip_serializing)]", "    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,", "    pub process_id: Option<u32>,", "}", "", "impl RpcClient {", "    #[allow(clippy::new_ret_no_self)]", "    pub fn new(", "        language_id: LanguageId,", "        reader: impl BufRead + Send + 'static,", "        writer: impl Write + Send + 'static,", "        process_id: Option<u32>,", "        sink: Sender<Call>,", "        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,", "    ) -> Result<Self> {", "        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();", "", "        let language_id_clone = language_id.clone();", "        let reader_thread_name = format!(\"reader-{:?}\", language_id);", "        let on_crash_clone = on_crash.clone();", "        thread::Builder::new()", "            .name(reader_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {", "                            on_crash_clone(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);", "                }", "            })?;", "", "        let (writer_tx, writer_rx) = unbounded();", "        let writer_thread_name = format!(\"writer-{:?}\", language_id);", "        let language_id_clone = language_id.clone();", "        thread::Builder::new()", "            .name(writer_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {", "                            on_crash(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);", "                }", "            })?;", "", "        Ok(Self {", "            language_id,", "            id: AtomicU64::default(),", "            process_id,", "            reader_tx,", "            writer_tx,", "        })", "    }", "", "    pub fn call<R: DeserializeOwned>(", "        &self,", "        method: impl AsRef<str>,", "        params: impl Serialize,", "    ) -> Result<R> {", "        let method = method.as_ref();", "        let id = self.id.fetch_add(1, Ordering::SeqCst);", "        let msg = jsonrpc_core::MethodCall {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            id: jsonrpc_core::Id::Num(id),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        let (tx, rx) = bounded(1);", "        self.reader_tx.send((id, tx))?;", "        self.writer_tx.send(RawMessage::MethodCall(msg))?;", "        // TODO: duration from config.", "        match rx.recv_timeout(Duration::from_secs(60))? {", "            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),", "            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,", "            // which we don't want to show to the user and should ignore, as the result of the", "            // request that triggered this error has been invalidated by changes to the state", "            // of the server, so we must handle this error specifically.", "            jsonrpc_core::Output::Failure(err)", "                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>", "            {", "                Err(anyhow::Error::from(LSError::ContentModified))", "            }", "            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),", "        }", "    }", "", "    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {", "        let method = method.as_ref();", "", "        let msg = jsonrpc_core::Notification {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        self.writer_tx.send(RawMessage::Notification(msg))?;", "        Ok(())", "    }", "", "    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {", "        let output = match result {", "            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                result: serde_json::to_value(ok)?,", "            }),", "            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                error: err.to_rpc_error(),", "            }),", "        };", "", "        self.writer_tx.send(RawMessage::Output(output))?;", "        Ok(())", "    }", "}", "", "fn loop_read(", "    reader: impl BufRead,", "    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,", "    sink: &Sender<Call>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut pending_outputs = HashMap::new();", "", "    // Count how many consequent empty lines.", "    let mut count_empty_lines = 0;", "", "    let mut reader = reader;", "    let mut content_length = 0;", "    loop {", "        let mut message = String::new();", "        let mut line = String::new();", "        if language_id.is_some() {", "            reader.read_line(&mut line)?;", "            let line = line.trim();", "            if line.is_empty() {", "                count_empty_lines += 1;", "                if count_empty_lines > 5 {", "                    return Err(anyhow!(\"Unable to read from language server\"));", "                }", "", "                let mut buf = vec![0; content_length];", "                reader.read_exact(buf.as_mut_slice())?;", "                message = String::from_utf8(buf)?;", "            } else {", "                count_empty_lines = 0;", "                if !line.starts_with(\"Content-Length\") {", "                    continue;", "                }", "", "                let tokens: Vec<&str> = line.splitn(2, ':').collect();", "                let len = tokens", "                    .get(1)", "                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?", "                    .trim();", "                content_length = usize::from_str(len)?;", "            }", "        } else if reader.read_line(&mut message)? == 0 {", "            break;", "        }", "", "        let message = message.trim();", "        if message.is_empty() {", "            continue;", "        }", "        debug!(\"<= {:?} {}\", language_id, message);", "        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and", "        // `requestMethod` sent by Sorbet.", "        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let message = serde_json::from_str(&s);", "        if let Err(ref err) = message {", "            error!(", "                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",", "                err, s, err", "            );", "            continue;", "        }", "        // TODO: cleanup.", "        let message = message.unwrap();", "        match message {", "            RawMessage::MethodCall(method_call) => {", "                sink.send(Call::MethodCall(language_id.clone(), method_call))?;", "            }", "            RawMessage::Notification(notification) => {", "                sink.send(Call::Notification(language_id.clone(), notification))?;", "            }", "            RawMessage::Output(output) => {", "                while let Ok((id, tx)) = reader_rx.try_recv() {", "                    pending_outputs.insert(id, tx);", "                }", "", "                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {", "                    tx.send(output)", "                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;", "                }", "            }", "        };", "    }", "", "    info!(\"reader-{:?} terminated\", language_id);", "    Ok(())", "}", "", "fn loop_write(", "    writer: impl Write,", "    rx: &Receiver<RawMessage>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut writer = writer;", "", "    for msg in rx.iter() {", "        let s = serde_json::to_string(&msg)?;", "        debug!(\"=> {:?} {}\", language_id, s);", "        if language_id.is_none() {", "            // Use different convention for two reasons,", "            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim", "            // receives `content`.", "            // 2. Without last line ending, vim output handler won't be triggered.", "            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;", "        } else {", "            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;", "        };", "        writer.flush()?;", "    }", "    Ok(())", "}", "", "#[cfg(test)]", "mod test {", "    use super::RE_REMOVE_EXTRA_FIELDS;", "    use crate::types::RawMessage;", "", "    #[test]", "    // The library we're using for json-rpc doesn't accept extra fields in the structs used to", "    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so", "    // the client fails to deserialize that response.", "    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is", "    // suboptimal, so we now try to remove the extra fields we know of from the response.", "    //", "    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892", "    fn it_should_remove_extra_fields() {", "        // it removes the requestMethod field from Sorbet", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        let message =", "            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        // it removes the meta field from javascript-typescript-langserver", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "    }", "}", ""]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#position()"],"id":26}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 26, "jsonrpc": "2.0", "result": {"character": 45, "line": 49}}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["expand('<cword>')"],"id":27}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 27, "jsonrpc": "2.0", "result": "clone"}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/definition","params":{"bufnr":1,"character":45,"filename":"/home/dick/LanguageClient-neovim/src/rpcclient.rs","gotoCmd":null,"handle":true,"languageId":"rust","line":49,"method":"textDocument/definition","position":{"character":45,"line":49},"text":["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};","use anyhow::{anyhow, Result};","use crossbeam::channel::{bounded, unbounded, Receiver, Sender};","use log::*;","use regex::Regex;","use serde::{de::DeserializeOwned, Serialize};","use std::io::Write;","use std::str::FromStr;","use std::{","    collections::HashMap,","    io::BufRead,","    sync::atomic::{AtomicU64, Ordering},","    thread,","    time::Duration,","};","","const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;","","lazy_static! {","    // this regex is used to remove some additional fields that we get from some servers, namely:","    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.","    static ref RE_REMOVE_EXTRA_FIELDS: Regex =","        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();","}","","#[derive(Serialize)]","pub struct RpcClient {","    language_id: LanguageId,","    #[serde(skip_serializing)]","    id: AtomicU64,","    #[serde(skip_serializing)]","    writer_tx: Sender<RawMessage>,","    #[serde(skip_serializing)]","    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,","    pub process_id: Option<u32>,","}","","impl RpcClient {","    #[allow(clippy::new_ret_no_self)]","    pub fn new(","        language_id: LanguageId,","        reader: impl BufRead + Send + 'static,","        writer: impl Write + Send + 'static,","        process_id: Option<u32>,","        sink: Sender<Call>,","        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,","    ) -> Result<Self> {","        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();","","        let language_id_clone = language_id.clone();","        let reader_thread_name = format!(\"reader-{:?}\", language_id);","        let on_crash_clone = on_crash.clone();","        thread::Builder::new()","            .name(reader_thread_name.clone())","            .spawn(move || {","                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {","                    match err.downcast_ref::<std::io::Error>() {","                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {","                            on_crash_clone(&language_id_clone)","                        }","                        _ => {}","                    }","","                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);","                }","            })?;","","        let (writer_tx, writer_rx) = unbounded();","        let writer_thread_name = format!(\"writer-{:?}\", language_id);","        let language_id_clone = language_id.clone();","        thread::Builder::new()","            .name(writer_thread_name.clone())","            .spawn(move || {","                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {","                    match err.downcast_ref::<std::io::Error>() {","                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {","                            on_crash(&language_id_clone)","                        }","                        _ => {}","                    }","","                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);","                }","            })?;","","        Ok(Self {","            language_id,","            id: AtomicU64::default(),","            process_id,","            reader_tx,","            writer_tx,","        })","    }","","    pub fn call<R: DeserializeOwned>(","        &self,","        method: impl AsRef<str>,","        params: impl Serialize,","    ) -> Result<R> {","        let method = method.as_ref();","        let id = self.id.fetch_add(1, Ordering::SeqCst);","        let msg = jsonrpc_core::MethodCall {","            jsonrpc: Some(jsonrpc_core::Version::V2),","            id: jsonrpc_core::Id::Num(id),","            method: method.to_owned(),","            params: params.to_params()?,","        };","        let (tx, rx) = bounded(1);","        self.reader_tx.send((id, tx))?;","        self.writer_tx.send(RawMessage::MethodCall(msg))?;","        // TODO: duration from config.","        match rx.recv_timeout(Duration::from_secs(60))? {","            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),","            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,","            // which we don't want to show to the user and should ignore, as the result of the","            // request that triggered this error has been invalidated by changes to the state","            // of the server, so we must handle this error specifically.","            jsonrpc_core::Output::Failure(err)","                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>","            {","                Err(anyhow::Error::from(LSError::ContentModified))","            }","            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),","        }","    }","","    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {","        let method = method.as_ref();","","        let msg = jsonrpc_core::Notification {","            jsonrpc: Some(jsonrpc_core::Version::V2),","            method: method.to_owned(),","            params: params.to_params()?,","        };","        self.writer_tx.send(RawMessage::Notification(msg))?;","        Ok(())","    }","","    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {","        let output = match result {","            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {","                jsonrpc: Some(jsonrpc_core::Version::V2),","                id: jsonrpc_core::Id::Num(id),","                result: serde_json::to_value(ok)?,","            }),","            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {","                jsonrpc: Some(jsonrpc_core::Version::V2),","                id: jsonrpc_core::Id::Num(id),","                error: err.to_rpc_error(),","            }),","        };","","        self.writer_tx.send(RawMessage::Output(output))?;","        Ok(())","    }","}","","fn loop_read(","    reader: impl BufRead,","    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,","    sink: &Sender<Call>,","    language_id: &LanguageId,",") -> Result<()> {","    let mut pending_outputs = HashMap::new();","","    // Count how many consequent empty lines.","    let mut count_empty_lines = 0;","","    let mut reader = reader;","    let mut content_length = 0;","    loop {","        let mut message = String::new();","        let mut line = String::new();","        if language_id.is_some() {","            reader.read_line(&mut line)?;","            let line = line.trim();","            if line.is_empty() {","                count_empty_lines += 1;","                if count_empty_lines > 5 {","                    return Err(anyhow!(\"Unable to read from language server\"));","                }","","                let mut buf = vec![0; content_length];","                reader.read_exact(buf.as_mut_slice())?;","                message = String::from_utf8(buf)?;","            } else {","                count_empty_lines = 0;","                if !line.starts_with(\"Content-Length\") {","                    continue;","                }","","                let tokens: Vec<&str> = line.splitn(2, ':').collect();","                let len = tokens","                    .get(1)","                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?","                    .trim();","                content_length = usize::from_str(len)?;","            }","        } else if reader.read_line(&mut message)? == 0 {","            break;","        }","","        let message = message.trim();","        if message.is_empty() {","            continue;","        }","        debug!(\"<= {:?} {}\", language_id, message);","        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and","        // `requestMethod` sent by Sorbet.","        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let message = serde_json::from_str(&s);","        if let Err(ref err) = message {","            error!(","                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",","                err, s, err","            );","            continue;","        }","        // TODO: cleanup.","        let message = message.unwrap();","        match message {","            RawMessage::MethodCall(method_call) => {","                sink.send(Call::MethodCall(language_id.clone(), method_call))?;","            }","            RawMessage::Notification(notification) => {","                sink.send(Call::Notification(language_id.clone(), notification))?;","            }","            RawMessage::Output(output) => {","                while let Ok((id, tx)) = reader_rx.try_recv() {","                    pending_outputs.insert(id, tx);","                }","","                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {","                    tx.send(output)","                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;","                }","            }","        };","    }","","    info!(\"reader-{:?} terminated\", language_id);","    Ok(())","}","","fn loop_write(","    writer: impl Write,","    rx: &Receiver<RawMessage>,","    language_id: &LanguageId,",") -> Result<()> {","    let mut writer = writer;","","    for msg in rx.iter() {","        let s = serde_json::to_string(&msg)?;","        debug!(\"=> {:?} {}\", language_id, s);","        if language_id.is_none() {","            // Use different convention for two reasons,","            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim","            // receives `content`.","            // 2. Without last line ending, vim output handler won't be triggered.","            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;","        } else {","            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;","        };","        writer.flush()?;","    }","    Ok(())","}","","#[cfg(test)]","mod test {","    use super::RE_REMOVE_EXTRA_FIELDS;","    use crate::types::RawMessage;","","    #[test]","    // The library we're using for json-rpc doesn't accept extra fields in the structs used to","    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so","    // the client fails to deserialize that response.","    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is","    // suboptimal, so we now try to remove the extra fields we know of from the response.","    //","    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892","    fn it_should_remove_extra_fields() {","        // it removes the requestMethod field from Sorbet","        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;","        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let result: Result<RawMessage, _> = serde_json::from_str(&message);","        assert!(result.is_ok());","","        let message =","            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;","        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let result: Result<RawMessage, _> = serde_json::from_str(&message);","        assert!(result.is_ok());","","        // it removes the meta field from javascript-typescript-langserver","        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;","        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let result: Result<RawMessage, _> = serde_json::from_str(&message);","        assert!(result.is_ok());","    }","}",""],"textDocument":{"uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs"}},"id":2}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":2,"result":[{"originSelectionRange":{"start":{"line":49,"character":44},"end":{"line":49,"character":49}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1886,"character":4},"end":{"line":1892,"character":5}},"targetSelectionRange":{"start":{"line":1887,"character":7},"end":{"line":1887,"character":12}}}]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:Edit","params":["edit","/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"cursor","params":[1888,8]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["expand('%')"],"id":28}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleFileType", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 22, "start": 0}, "languageId": "rust", "position": {"character": 0, "line": 0}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:2760 handle_file_type; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})})
17:00:16 INFO unnamed src/language_server_protocol.rs:1946 text_document_did_open; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"LSP#text","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"],"id":29}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleBufEnter", "jsonrpc": "2.0", "params": {"bufnr": 2, "languageId": "rust", "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:2739 handle_buf_enter; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust")})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","LanguageClient_isServerRunning",1]}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 28, "jsonrpc": "2.0", "result": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:EchomsgEllipsis","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs 1888:8"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","result":[{"originSelectionRange":{"end":{"character":49,"line":49},"start":{"character":44,"line":49}},"targetRange":{"end":{"character":5,"line":1892},"start":{"character":4,"line":1886}},"targetSelectionRange":{"end":{"character":12,"line":1887},"start":{"character":7,"line":1887}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}],"id":1}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 29, "jsonrpc": "2.0", "result": ["//! Optional values.", "//!", "//! Type [`Option`] represents an optional value: every [`Option`]", "//! is either [`Some`] and contains a value, or [`None`], and", "//! does not. [`Option`] types are very common in Rust code, as", "//! they have a number of uses:", "//!", "//! * Initial values", "//! * Return values for functions that are not defined", "//!   over their entire input range (partial functions)", "//! * Return value for otherwise reporting simple errors, where [`None`] is", "//!   returned on error", "//! * Optional struct fields", "//! * Struct fields that can be loaned or \"taken\"", "//! * Optional function arguments", "//! * Nullable pointers", "//! * Swapping things out of difficult situations", "//!", "//! [`Option`]s are commonly paired with pattern matching to query the presence", "//! of a value and take action, always accounting for the [`None`] case.", "//!", "//! ```", "//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {", "//!     if denominator == 0.0 {", "//!         None", "//!     } else {", "//!         Some(numerator / denominator)", "//!     }", "//! }", "//!", "//! // The return value of the function is an option", "//! let result = divide(2.0, 3.0);", "//!", "//! // Pattern match to retrieve the value", "//! match result {", "//!     // The division was valid", "//!     Some(x) => println!(\"Result: {x}\"),", "//!     // The division was invalid", "//!     None    => println!(\"Cannot divide by 0\"),", "//! }", "//! ```", "//!", "//", "// FIXME: Show how `Option` is used in practice, with lots of methods", "//", "//! # Options and pointers (\"nullable\" pointers)", "//!", "//! Rust's pointer types must always point to a valid location; there are", "//! no \"null\" references. Instead, Rust has *optional* pointers, like", "//! the optional owned box, <code>[Option]<[Box\\<T>]></code>.", "//!", "//! [Box\\<T>]: ../../std/boxed/struct.Box.html", "//!", "//! The following example uses [`Option`] to create an optional box of", "//! [`i32`]. Notice that in order to use the inner [`i32`] value, the", "//! `check_optional` function first needs to use pattern matching to", "//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or", "//! not ([`None`]).", "//!", "//! ```", "//! let optional = None;", "//! check_optional(optional);", "//!", "//! let optional = Some(Box::new(9000));", "//! check_optional(optional);", "//!", "//! fn check_optional(optional: Option<Box<i32>>) {", "//!     match optional {", "//!         Some(p) => println!(\"has value {p}\"),", "//!         None => println!(\"has no value\"),", "//!     }", "//! }", "//! ```", "//!", "//! # Representation", "//!", "//! Rust guarantees to optimize the following types `T` such that", "//! [`Option<T>`] has the same size as `T`:", "//!", "//! * [`Box<U>`]", "//! * `&U`", "//! * `&mut U`", "//! * `fn`, `extern \"C\" fn`[^extern_fn]", "//! * [`num::NonZero*`]", "//! * [`ptr::NonNull<U>`]", "//! * `#[repr(transparent)]` struct around one of the types in this list.", "//!", "//! [^extern_fn]: this remains true for any other ABI: `extern \"abi\" fn` (_e.g._, `extern \"system\" fn`)", "//!", "//! [`Box<U>`]: ../../std/boxed/struct.Box.html", "//! [`num::NonZero*`]: crate::num", "//! [`ptr::NonNull<U>`]: crate::ptr::NonNull", "//!", "//! This is called the \"null pointer optimization\" or NPO.", "//!", "//! It is further guaranteed that, for the cases above, one can", "//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and", "//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`", "//! is undefined behaviour).", "//!", "//! # Method overview", "//!", "//! In addition to working with pattern matching, [`Option`] provides a wide", "//! variety of different methods.", "//!", "//! ## Querying the variant", "//!", "//! The [`is_some`] and [`is_none`] methods return [`true`] if the [`Option`]", "//! is [`Some`] or [`None`], respectively.", "//!", "//! [`is_none`]: Option::is_none", "//! [`is_some`]: Option::is_some", "//!", "//! ## Adapters for working with references", "//!", "//! * [`as_ref`] converts from <code>[&][][Option]\\<T></code> to <code>[Option]<[&]T></code>", "//! * [`as_mut`] converts from <code>[&mut] [Option]\\<T></code> to <code>[Option]<[&mut] T></code>", "//! * [`as_deref`] converts from <code>[&][][Option]\\<T></code> to", "//!   <code>[Option]<[&]T::[Target]></code>", "//! * [`as_deref_mut`] converts from <code>[&mut] [Option]\\<T></code> to", "//!   <code>[Option]<[&mut] T::[Target]></code>", "//! * [`as_pin_ref`] converts from <code>[Pin]<[&][][Option]\\<T>></code> to", "//!   <code>[Option]<[Pin]<[&]T>></code>", "//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\\<T>></code> to", "//!   <code>[Option]<[Pin]<[&mut] T>></code>", "//!", "//! [&]: reference \"shared reference\"", "//! [&mut]: reference \"mutable reference\"", "//! [Target]: Deref::Target \"ops::Deref::Target\"", "//! [`as_deref`]: Option::as_deref", "//! [`as_deref_mut`]: Option::as_deref_mut", "//! [`as_mut`]: Option::as_mut", "//! [`as_pin_mut`]: Option::as_pin_mut", "//! [`as_pin_ref`]: Option::as_pin_ref", "//! [`as_ref`]: Option::as_ref", "//!", "//! ## Extracting the contained value", "//!", "//! These methods extract the contained value in an [`Option<T>`] when it", "//! is the [`Some`] variant. If the [`Option`] is [`None`]:", "//!", "//! * [`expect`] panics with a provided custom message", "//! * [`unwrap`] panics with a generic message", "//! * [`unwrap_or`] returns the provided default value", "//! * [`unwrap_or_default`] returns the default value of the type `T`", "//!   (which must implement the [`Default`] trait)", "//! * [`unwrap_or_else`] returns the result of evaluating the provided", "//!   function", "//!", "//! [`expect`]: Option::expect", "//! [`unwrap`]: Option::unwrap", "//! [`unwrap_or`]: Option::unwrap_or", "//! [`unwrap_or_default`]: Option::unwrap_or_default", "//! [`unwrap_or_else`]: Option::unwrap_or_else", "//!", "//! ## Transforming contained values", "//!", "//! These methods transform [`Option`] to [`Result`]:", "//!", "//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to", "//!   [`Err(err)`] using the provided default `err` value", "//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to", "//!   a value of [`Err`] using the provided function", "//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a", "//!   [`Result`] of an [`Option`]", "//!", "//! [`Err(err)`]: Err", "//! [`Ok(v)`]: Ok", "//! [`Some(v)`]: Some", "//! [`ok_or`]: Option::ok_or", "//! [`ok_or_else`]: Option::ok_or_else", "//! [`transpose`]: Option::transpose", "//!", "//! These methods transform the [`Some`] variant:", "//!", "//! * [`filter`] calls the provided predicate function on the contained", "//!   value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]", "//!   if the function returns `true`; otherwise, returns [`None`]", "//! * [`flatten`] removes one level of nesting from an", "//!   [`Option<Option<T>>`]", "//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the", "//!   provided function to the contained value of [`Some`] and leaving", "//!   [`None`] values unchanged", "//!", "//! [`Some(t)`]: Some", "//! [`filter`]: Option::filter", "//! [`flatten`]: Option::flatten", "//! [`map`]: Option::map", "//!", "//! These methods transform [`Option<T>`] to a value of a possibly", "//! different type `U`:", "//!", "//! * [`map_or`] applies the provided function to the contained value of", "//!   [`Some`], or returns the provided default value if the [`Option`] is", "//!   [`None`]", "//! * [`map_or_else`] applies the provided function to the contained value", "//!   of [`Some`], or returns the result of evaluating the provided", "//!   fallback function if the [`Option`] is [`None`]", "//!", "//! [`map_or`]: Option::map_or", "//! [`map_or_else`]: Option::map_or_else", "//!", "//! These methods combine the [`Some`] variants of two [`Option`] values:", "//!", "//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the", "//!   provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]", "//! * [`zip_with`] calls the provided function `f` and returns", "//!   [`Some(f(s, o))`] if `self` is [`Some(s)`] and the provided", "//!   [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]", "//!", "//! [`Some(f(s, o))`]: Some", "//! [`Some(o)`]: Some", "//! [`Some(s)`]: Some", "//! [`Some((s, o))`]: Some", "//! [`zip`]: Option::zip", "//! [`zip_with`]: Option::zip_with", "//!", "//! ## Boolean operators", "//!", "//! These methods treat the [`Option`] as a boolean value, where [`Some`]", "//! acts like [`true`] and [`None`] acts like [`false`]. There are two", "//! categories of these methods: ones that take an [`Option`] as input, and", "//! ones that take a function as input (to be lazily evaluated).", "//!", "//! The [`and`], [`or`], and [`xor`] methods take another [`Option`] as", "//! input, and produce an [`Option`] as output. Only the [`and`] method can", "//! produce an [`Option<U>`] value having a different inner type `U` than", "//! [`Option<T>`].", "//!", "//! | method  | self      | input     | output    |", "//! |---------|-----------|-----------|-----------|", "//! | [`and`] | `None`    | (ignored) | `None`    |", "//! | [`and`] | `Some(x)` | `None`    | `None`    |", "//! | [`and`] | `Some(x)` | `Some(y)` | `Some(y)` |", "//! | [`or`]  | `None`    | `None`    | `None`    |", "//! | [`or`]  | `None`    | `Some(y)` | `Some(y)` |", "//! | [`or`]  | `Some(x)` | (ignored) | `Some(x)` |", "//! | [`xor`] | `None`    | `None`    | `None`    |", "//! | [`xor`] | `None`    | `Some(y)` | `Some(y)` |", "//! | [`xor`] | `Some(x)` | `None`    | `Some(x)` |", "//! | [`xor`] | `Some(x)` | `Some(y)` | `None`    |", "//!", "//! [`and`]: Option::and", "//! [`or`]: Option::or", "//! [`xor`]: Option::xor", "//!", "//! The [`and_then`] and [`or_else`] methods take a function as input, and", "//! only evaluate the function when they need to produce a new value. Only", "//! the [`and_then`] method can produce an [`Option<U>`] value having a", "//! different inner type `U` than [`Option<T>`].", "//!", "//! | method       | self      | function input | function result | output    |", "//! |--------------|-----------|----------------|-----------------|-----------|", "//! | [`and_then`] | `None`    | (not provided) | (not evaluated) | `None`    |", "//! | [`and_then`] | `Some(x)` | `x`            | `None`          | `None`    |", "//! | [`and_then`] | `Some(x)` | `x`            | `Some(y)`       | `Some(y)` |", "//! | [`or_else`]  | `None`    | (not provided) | `None`          | `None`    |", "//! | [`or_else`]  | `None`    | (not provided) | `Some(y)`       | `Some(y)` |", "//! | [`or_else`]  | `Some(x)` | (not provided) | (not evaluated) | `Some(x)` |", "//!", "//! [`and_then`]: Option::and_then", "//! [`or_else`]: Option::or_else", "//!", "//! This is an example of using methods like [`and_then`] and [`or`] in a", "//! pipeline of method calls. Early stages of the pipeline pass failure", "//! values ([`None`]) through unchanged, and continue processing on", "//! success values ([`Some`]). Toward the end, [`or`] substitutes an error", "//! message if it receives [`None`].", "//!", "//! ```", "//! # use std::collections::BTreeMap;", "//! let mut bt = BTreeMap::new();", "//! bt.insert(20u8, \"foo\");", "//! bt.insert(42u8, \"bar\");", "//! let res = [0u8, 1, 11, 200, 22]", "//!     .into_iter()", "//!     .map(|x| {", "//!         // `checked_sub()` returns `None` on error", "//!         x.checked_sub(1)", "//!             // same with `checked_mul()`", "//!             .and_then(|x| x.checked_mul(2))", "//!             // `BTreeMap::get` returns `None` on error", "//!             .and_then(|x| bt.get(&x))", "//!             // Substitute an error message if we have `None` so far", "//!             .or(Some(&\"error!\"))", "//!             .copied()", "//!             // Won't panic because we unconditionally used `Some` above", "//!             .unwrap()", "//!     })", "//!     .collect::<Vec<_>>();", "//! assert_eq!(res, [\"error!\", \"error!\", \"foo\", \"error!\", \"bar\"]);", "//! ```", "//!", "//! ## Comparison operators", "//!", "//! If `T` implements [`PartialOrd`] then [`Option<T>`] will derive its", "//! [`PartialOrd`] implementation.  With this order, [`None`] compares as", "//! less than any [`Some`], and two [`Some`] compare the same way as their", "//! contained values would in `T`.  If `T` also implements", "//! [`Ord`], then so does [`Option<T>`].", "//!", "//! ```", "//! assert!(None < Some(0));", "//! assert!(Some(0) < Some(1));", "//! ```", "//!", "//! ## Iterating over `Option`", "//!", "//! An [`Option`] can be iterated over. This can be helpful if you need an", "//! iterator that is conditionally empty. The iterator will either produce", "//! a single value (when the [`Option`] is [`Some`]), or produce no values", "//! (when the [`Option`] is [`None`]). For example, [`into_iter`] acts like", "//! [`once(v)`] if the [`Option`] is [`Some(v)`], and like [`empty()`] if", "//! the [`Option`] is [`None`].", "//!", "//! [`Some(v)`]: Some", "//! [`empty()`]: crate::iter::empty", "//! [`once(v)`]: crate::iter::once", "//!", "//! Iterators over [`Option<T>`] come in three types:", "//!", "//! * [`into_iter`] consumes the [`Option`] and produces the contained", "//!   value", "//! * [`iter`] produces an immutable reference of type `&T` to the", "//!   contained value", "//! * [`iter_mut`] produces a mutable reference of type `&mut T` to the", "//!   contained value", "//!", "//! [`into_iter`]: Option::into_iter", "//! [`iter`]: Option::iter", "//! [`iter_mut`]: Option::iter_mut", "//!", "//! An iterator over [`Option`] can be useful when chaining iterators, for", "//! example, to conditionally insert items. (It's not always necessary to", "//! explicitly call an iterator constructor: many [`Iterator`] methods that", "//! accept other iterators will also accept iterable types that implement", "//! [`IntoIterator`], which includes [`Option`].)", "//!", "//! ```", "//! let yep = Some(42);", "//! let nope = None;", "//! // chain() already calls into_iter(), so we don't have to do so", "//! let nums: Vec<i32> = (0..4).chain(yep).chain(4..8).collect();", "//! assert_eq!(nums, [0, 1, 2, 3, 42, 4, 5, 6, 7]);", "//! let nums: Vec<i32> = (0..4).chain(nope).chain(4..8).collect();", "//! assert_eq!(nums, [0, 1, 2, 3, 4, 5, 6, 7]);", "//! ```", "//!", "//! One reason to chain iterators in this way is that a function returning", "//! `impl Iterator` must have all possible return values be of the same", "//! concrete type. Chaining an iterated [`Option`] can help with that.", "//!", "//! ```", "//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {", "//!     // Explicit returns to illustrate return types matching", "//!     match do_insert {", "//!         true => return (0..4).chain(Some(42)).chain(4..8),", "//!         false => return (0..4).chain(None).chain(4..8),", "//!     }", "//! }", "//! println!(\"{:?}\", make_iter(true).collect::<Vec<_>>());", "//! println!(\"{:?}\", make_iter(false).collect::<Vec<_>>());", "//! ```", "//!", "//! If we try to do the same thing, but using [`once()`] and [`empty()`],", "//! we can't return `impl Iterator` anymore because the concrete types of", "//! the return values differ.", "//!", "//! [`empty()`]: crate::iter::empty", "//! [`once()`]: crate::iter::once", "//!", "//! ```compile_fail,E0308", "//! # use std::iter::{empty, once};", "//! // This won't compile because all possible returns from the function", "//! // must have the same concrete type.", "//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {", "//!     // Explicit returns to illustrate return types not matching", "//!     match do_insert {", "//!         true => return (0..4).chain(once(42)).chain(4..8),", "//!         false => return (0..4).chain(empty()).chain(4..8),", "//!     }", "//! }", "//! ```", "//!", "//! ## Collecting into `Option`", "//!", "//! [`Option`] implements the [`FromIterator`][impl-FromIterator] trait,", "//! which allows an iterator over [`Option`] values to be collected into an", "//! [`Option`] of a collection of each contained value of the original", "//! [`Option`] values, or [`None`] if any of the elements was [`None`].", "//!", "//! [impl-FromIterator]: Option#impl-FromIterator%3COption%3CA%3E%3E", "//!", "//! ```", "//! let v = [Some(2), Some(4), None, Some(8)];", "//! let res: Option<Vec<_>> = v.into_iter().collect();", "//! assert_eq!(res, None);", "//! let v = [Some(2), Some(4), Some(8)];", "//! let res: Option<Vec<_>> = v.into_iter().collect();", "//! assert_eq!(res, Some(vec![2, 4, 8]));", "//! ```", "//!", "//! [`Option`] also implements the [`Product`][impl-Product] and", "//! [`Sum`][impl-Sum] traits, allowing an iterator over [`Option`] values", "//! to provide the [`product`][Iterator::product] and", "//! [`sum`][Iterator::sum] methods.", "//!", "//! [impl-Product]: Option#impl-Product%3COption%3CU%3E%3E", "//! [impl-Sum]: Option#impl-Sum%3COption%3CU%3E%3E", "//!", "//! ```", "//! let v = [None, Some(1), Some(2), Some(3)];", "//! let res: Option<i32> = v.into_iter().sum();", "//! assert_eq!(res, None);", "//! let v = [Some(1), Some(2), Some(21)];", "//! let res: Option<i32> = v.into_iter().product();", "//! assert_eq!(res, Some(42));", "//! ```", "//!", "//! ## Modifying an [`Option`] in-place", "//!", "//! These methods return a mutable reference to the contained value of an", "//! [`Option<T>`]:", "//!", "//! * [`insert`] inserts a value, dropping any old contents", "//! * [`get_or_insert`] gets the current value, inserting a provided", "//!   default value if it is [`None`]", "//! * [`get_or_insert_default`] gets the current value, inserting the", "//!   default value of type `T` (which must implement [`Default`]) if it is", "//!   [`None`]", "//! * [`get_or_insert_with`] gets the current value, inserting a default", "//!   computed by the provided function if it is [`None`]", "//!", "//! [`get_or_insert`]: Option::get_or_insert", "//! [`get_or_insert_default`]: Option::get_or_insert_default", "//! [`get_or_insert_with`]: Option::get_or_insert_with", "//! [`insert`]: Option::insert", "//!", "//! These methods transfer ownership of the contained value of an", "//! [`Option`]:", "//!", "//! * [`take`] takes ownership of the contained value of an [`Option`], if", "//!   any, replacing the [`Option`] with [`None`]", "//! * [`replace`] takes ownership of the contained value of an [`Option`],", "//!   if any, replacing the [`Option`] with a [`Some`] containing the", "//!   provided value", "//!", "//! [`replace`]: Option::replace", "//! [`take`]: Option::take", "//!", "//! # Examples", "//!", "//! Basic pattern matching on [`Option`]:", "//!", "//! ```", "//! let msg = Some(\"howdy\");", "//!", "//! // Take a reference to the contained string", "//! if let Some(m) = &msg {", "//!     println!(\"{}\", *m);", "//! }", "//!", "//! // Remove the contained string, destroying the Option", "//! let unwrapped_msg = msg.unwrap_or(\"default message\");", "//! ```", "//!", "//! Initialize a result to [`None`] before a loop:", "//!", "//! ```", "//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }", "//!", "//! // A list of data to search through.", "//! let all_the_big_things = [", "//!     Kingdom::Plant(250, \"redwood\"),", "//!     Kingdom::Plant(230, \"noble fir\"),", "//!     Kingdom::Plant(229, \"sugar pine\"),", "//!     Kingdom::Animal(25, \"blue whale\"),", "//!     Kingdom::Animal(19, \"fin whale\"),", "//!     Kingdom::Animal(15, \"north pacific right whale\"),", "//! ];", "//!", "//! // We're going to search for the name of the biggest animal,", "//! // but to start with we've just got `None`.", "//! let mut name_of_biggest_animal = None;", "//! let mut size_of_biggest_animal = 0;", "//! for big_thing in &all_the_big_things {", "//!     match *big_thing {", "//!         Kingdom::Animal(size, name) if size > size_of_biggest_animal => {", "//!             // Now we've found the name of some big animal", "//!             size_of_biggest_animal = size;", "//!             name_of_biggest_animal = Some(name);", "//!         }", "//!         Kingdom::Animal(..) | Kingdom::Plant(..) => ()", "//!     }", "//! }", "//!", "//! match name_of_biggest_animal {", "//!     Some(name) => println!(\"the biggest animal is {name}\"),", "//!     None => println!(\"there are no animals :(\"),", "//! }", "//! ```", "", "#![stable(feature = \"rust1\", since = \"1.0.0\")]", "", "use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};", "use crate::marker::Destruct;", "use crate::panicking::{panic, panic_str};", "use crate::pin::Pin;", "use crate::{", "    convert, hint, mem,", "    ops::{self, ControlFlow, Deref, DerefMut},", "};", "", "/// The `Option` type. See [the module level documentation](self) for more.", "#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]", "#[rustc_diagnostic_item = \"Option\"]", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "pub enum Option<T> {", "    /// No value.", "    #[lang = \"None\"]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    None,", "    /// Some value of type `T`.", "    #[lang = \"Some\"]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    Some(#[stable(feature = \"rust1\", since = \"1.0.0\")] T),", "}", "", "/////////////////////////////////////////////////////////////////////////////", "// Type implementation", "/////////////////////////////////////////////////////////////////////////////", "", "impl<T> Option<T> {", "    /////////////////////////////////////////////////////////////////////////", "    // Querying the contained values", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns `true` if the option is a [`Some`] value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.is_some(), true);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.is_some(), false);", "    /// ```", "    #[must_use = \"if you intended to assert that this has a value, consider `.unwrap()` instead\"]", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]", "    pub const fn is_some(&self) -> bool {", "        matches!(*self, Some(_))", "    }", "", "    /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(is_some_with)]", "    ///", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.is_some_and(|&x| x > 1), true);", "    ///", "    /// let x: Option<u32> = Some(0);", "    /// assert_eq!(x.is_some_and(|&x| x > 1), false);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.is_some_and(|&x| x > 1), false);", "    /// ```", "    #[must_use]", "    #[inline]", "    #[unstable(feature = \"is_some_with\", issue = \"93050\")]", "    pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool {", "        matches!(self, Some(x) if f(x))", "    }", "", "    /// Returns `true` if the option is a [`None`] value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.is_none(), false);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.is_none(), true);", "    /// ```", "    #[must_use = \"if you intended to assert that this doesn't have a value, consider \\", "                  `.and_then(|_| panic!(\\\"`Option` had a value when expected `None`\\\"))` instead\"]", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]", "    pub const fn is_none(&self) -> bool {", "        !self.is_some()", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Adapter for working with references", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Converts from `&Option<T>` to `Option<&T>`.", "    ///", "    /// # Examples", "    ///", "    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving", "    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,", "    /// so this technique uses `as_ref` to first take an `Option` to a reference", "    /// to the value inside the original.", "    ///", "    /// [`map`]: Option::map", "    /// [String]: ../../std/string/struct.String.html \"String\"", "    ///", "    /// ```", "    /// let text: Option<String> = Some(\"Hello, world!\".to_string());", "    /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,", "    /// // then consume *that* with `map`, leaving `text` on the stack.", "    /// let text_length: Option<usize> = text.as_ref().map(|s| s.len());", "    /// println!(\"still can print text: {text:?}\");", "    /// ```", "    #[inline]", "    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    pub const fn as_ref(&self) -> Option<&T> {", "        match *self {", "            Some(ref x) => Some(x),", "            None => None,", "        }", "    }", "", "    /// Converts from `&mut Option<T>` to `Option<&mut T>`.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(2);", "    /// match x.as_mut() {", "    ///     Some(v) => *v = 42,", "    ///     None => {},", "    /// }", "    /// assert_eq!(x, Some(42));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn as_mut(&mut self) -> Option<&mut T> {", "        match *self {", "            Some(ref mut x) => Some(x),", "            None => None,", "        }", "    }", "", "    /// Converts from <code>[Pin]<[&]Option\\<T>></code> to <code>Option<[Pin]<[&]T>></code>.", "    ///", "    /// [&]: reference \"shared reference\"", "    #[inline]", "    #[must_use]", "    #[stable(feature = \"pin\", since = \"1.33.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {", "        match Pin::get_ref(self).as_ref() {", "            // SAFETY: `x` is guaranteed to be pinned because it comes from `self`", "            // which is pinned.", "            Some(x) => unsafe { Some(Pin::new_unchecked(x)) },", "            None => None,", "        }", "    }", "", "    /// Converts from <code>[Pin]<[&mut] Option\\<T>></code> to <code>Option<[Pin]<[&mut] T>></code>.", "    ///", "    /// [&mut]: reference \"mutable reference\"", "    #[inline]", "    #[must_use]", "    #[stable(feature = \"pin\", since = \"1.33.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {", "        // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.", "        // `x` is guaranteed to be pinned because it comes from `self` which is pinned.", "        unsafe {", "            match Pin::get_unchecked_mut(self).as_mut() {", "                Some(x) => Some(Pin::new_unchecked(x)),", "                None => None,", "            }", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Getting to contained values", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns the contained [`Some`] value, consuming the `self` value.", "    ///", "    /// # Panics", "    ///", "    /// Panics if the value is a [`None`] with a custom panic message provided by", "    /// `msg`.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"value\");", "    /// assert_eq!(x.expect(\"fruits are healthy\"), \"value\");", "    /// ```", "    ///", "    /// ```should_panic", "    /// let x: Option<&str> = None;", "    /// x.expect(\"fruits are healthy\"); // panics with `fruits are healthy`", "    /// ```", "    ///", "    /// # Recommended Message Style", "    ///", "    /// We recommend that `expect` messages are used to describe the reason you", "    /// _expect_ the `Option` should be `Some`.", "    ///", "    /// ```should_panic", "    /// # let slice: &[u8] = &[];", "    /// let item = slice.get(0)", "    ///     .expect(\"slice should not be empty\");", "    /// ```", "    ///", "    /// **Hint**: If you're having trouble remembering how to phrase expect", "    /// error messages remember to focus on the word \"should\" as in \"env", "    /// variable should be set by blah\" or \"the given binary should be available", "    /// and executable by the current user\".", "    ///", "    /// For more detail on expect message styles and the reasoning behind our", "    /// recommendation please refer to the section on [\"Common Message", "    /// Styles\"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs.", "    #[inline]", "    #[track_caller]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn expect(self, msg: &str) -> T {", "        match self {", "            Some(val) => val,", "            None => expect_failed(msg),", "        }", "    }", "", "    /// Returns the contained [`Some`] value, consuming the `self` value.", "    ///", "    /// Because this function may panic, its use is generally discouraged.", "    /// Instead, prefer to use pattern matching and handle the [`None`]", "    /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or", "    /// [`unwrap_or_default`].", "    ///", "    /// [`unwrap_or`]: Option::unwrap_or", "    /// [`unwrap_or_else`]: Option::unwrap_or_else", "    /// [`unwrap_or_default`]: Option::unwrap_or_default", "    ///", "    /// # Panics", "    ///", "    /// Panics if the self value equals [`None`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"air\");", "    /// assert_eq!(x.unwrap(), \"air\");", "    /// ```", "    ///", "    /// ```should_panic", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.unwrap(), \"air\"); // fails", "    /// ```", "    #[inline]", "    #[track_caller]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn unwrap(self) -> T {", "        match self {", "            Some(val) => val,", "            None => panic(\"called `Option::unwrap()` on a `None` value\"),", "        }", "    }", "", "    /// Returns the contained [`Some`] value or a provided default.", "    ///", "    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing", "    /// the result of a function call, it is recommended to use [`unwrap_or_else`],", "    /// which is lazily evaluated.", "    ///", "    /// [`unwrap_or_else`]: Option::unwrap_or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// assert_eq!(Some(\"car\").unwrap_or(\"bike\"), \"car\");", "    /// assert_eq!(None.unwrap_or(\"bike\"), \"bike\");", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn unwrap_or(self, default: T) -> T", "    where", "        T: ~const Destruct,", "    {", "        match self {", "            Some(x) => x,", "            None => default,", "        }", "    }", "", "    /// Returns the contained [`Some`] value or computes it from a closure.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let k = 10;", "    /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);", "    /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn unwrap_or_else<F>(self, f: F) -> T", "    where", "        F: ~const FnOnce() -> T,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => x,", "            None => f(),", "        }", "    }", "", "    /// Returns the contained [`Some`] value or a default.", "    ///", "    /// Consumes the `self` argument then, if [`Some`], returns the contained", "    /// value, otherwise if [`None`], returns the [default value] for that", "    /// type.", "    ///", "    /// # Examples", "    ///", "    /// Converts a string to an integer, turning poorly-formed strings", "    /// into 0 (the default value for integers). [`parse`] converts", "    /// a string to any other type that implements [`FromStr`], returning", "    /// [`None`] on error.", "    ///", "    /// ```", "    /// let good_year_from_input = \"1909\";", "    /// let bad_year_from_input = \"190blarg\";", "    /// let good_year = good_year_from_input.parse().ok().unwrap_or_default();", "    /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();", "    ///", "    /// assert_eq!(1909, good_year);", "    /// assert_eq!(0, bad_year);", "    /// ```", "    ///", "    /// [default value]: Default::default", "    /// [`parse`]: str::parse", "    /// [`FromStr`]: crate::str::FromStr", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn unwrap_or_default(self) -> T", "    where", "        T: ~const Default,", "    {", "        match self {", "            Some(x) => x,", "            None => Default::default(),", "        }", "    }", "", "    /// Returns the contained [`Some`] value, consuming the `self` value,", "    /// without checking that the value is not [`None`].", "    ///", "    /// # Safety", "    ///", "    /// Calling this method on [`None`] is *[undefined behavior]*.", "    ///", "    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"air\");", "    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\");", "    /// ```", "    ///", "    /// ```no_run", "    /// let x: Option<&str> = None;", "    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\"); // Undefined behavior!", "    /// ```", "    #[inline]", "    #[track_caller]", "    #[stable(feature = \"option_result_unwrap_unchecked\", since = \"1.58.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const unsafe fn unwrap_unchecked(self) -> T {", "        debug_assert!(self.is_some());", "        match self {", "            Some(val) => val,", "            // SAFETY: the safety contract must be upheld by the caller.", "            None => unsafe { hint::unreachable_unchecked() },", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Transforming contained values", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.", "    ///", "    /// # Examples", "    ///", "    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming", "    /// the original:", "    ///", "    /// [String]: ../../std/string/struct.String.html \"String\"", "    /// ```", "    /// let maybe_some_string = Some(String::from(\"Hello, World!\"));", "    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`", "    /// let maybe_some_len = maybe_some_string.map(|s| s.len());", "    ///", "    /// assert_eq!(maybe_some_len, Some(13));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn map<U, F>(self, f: F) -> Option<U>", "    where", "        F: ~const FnOnce(T) -> U,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => Some(f(x)),", "            None => None,", "        }", "    }", "", "    /// Calls the provided closure with a reference to the contained value (if [`Some`]).", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(result_option_inspect)]", "    ///", "    /// let v = vec![1, 2, 3, 4, 5];", "    ///", "    /// // prints \"got: 4\"", "    /// let x: Option<&usize> = v.get(3).inspect(|x| println!(\"got: {x}\"));", "    ///", "    /// // prints nothing", "    /// let x: Option<&usize> = v.get(5).inspect(|x| println!(\"got: {x}\"));", "    /// ```", "    #[inline]", "    #[unstable(feature = \"result_option_inspect\", issue = \"91345\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn inspect<F>(self, f: F) -> Self", "    where", "        F: ~const FnOnce(&T),", "        F: ~const Destruct,", "    {", "        if let Some(ref x) = self {", "            f(x);", "        }", "", "        self", "    }", "", "    /// Returns the provided default result (if none),", "    /// or applies a function to the contained value (if any).", "    ///", "    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing", "    /// the result of a function call, it is recommended to use [`map_or_else`],", "    /// which is lazily evaluated.", "    ///", "    /// [`map_or_else`]: Option::map_or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.map_or(42, |v| v.len()), 3);", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.map_or(42, |v| v.len()), 42);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn map_or<U, F>(self, default: U, f: F) -> U", "    where", "        F: ~const FnOnce(T) -> U,", "        F: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match self {", "            Some(t) => f(t),", "            None => default,", "        }", "    }", "", "    /// Computes a default function result (if none), or", "    /// applies a different function to the contained value (if any).", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let k = 21;", "    ///", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3);", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U", "    where", "        D: ~const FnOnce() -> U,", "        D: ~const Destruct,", "        F: ~const FnOnce(T) -> U,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(t) => f(t),", "            None => default(),", "        }", "    }", "", "    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to", "    /// [`Ok(v)`] and [`None`] to [`Err(err)`].", "    ///", "    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the", "    /// result of a function call, it is recommended to use [`ok_or_else`], which is", "    /// lazily evaluated.", "    ///", "    /// [`Ok(v)`]: Ok", "    /// [`Err(err)`]: Err", "    /// [`Some(v)`]: Some", "    /// [`ok_or_else`]: Option::ok_or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.ok_or(0), Ok(\"foo\"));", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.ok_or(0), Err(0));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn ok_or<E>(self, err: E) -> Result<T, E>", "    where", "        E: ~const Destruct,", "    {", "        match self {", "            Some(v) => Ok(v),", "            None => Err(err),", "        }", "    }", "", "    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to", "    /// [`Ok(v)`] and [`None`] to [`Err(err())`].", "    ///", "    /// [`Ok(v)`]: Ok", "    /// [`Err(err())`]: Err", "    /// [`Some(v)`]: Some", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.ok_or_else(|| 0), Ok(\"foo\"));", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.ok_or_else(|| 0), Err(0));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>", "    where", "        F: ~const FnOnce() -> E,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(v) => Ok(v),", "            None => Err(err()),", "        }", "    }", "", "    /// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.", "    ///", "    /// Leaves the original Option in-place, creating a new one with a reference", "    /// to the original one, additionally coercing the contents via [`Deref`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x: Option<String> = Some(\"hey\".to_owned());", "    /// assert_eq!(x.as_deref(), Some(\"hey\"));", "    ///", "    /// let x: Option<String> = None;", "    /// assert_eq!(x.as_deref(), None);", "    /// ```", "    #[stable(feature = \"option_deref\", since = \"1.40.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_deref(&self) -> Option<&T::Target>", "    where", "        T: ~const Deref,", "    {", "        match self.as_ref() {", "            Some(t) => Some(t.deref()),", "            None => None,", "        }", "    }", "", "    /// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.", "    ///", "    /// Leaves the original `Option` in-place, creating a new one containing a mutable reference to", "    /// the inner type's [`Deref::Target`] type.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x: Option<String> = Some(\"hey\".to_owned());", "    /// assert_eq!(x.as_deref_mut().map(|x| {", "    ///     x.make_ascii_uppercase();", "    ///     x", "    /// }), Some(\"HEY\".to_owned().as_mut_str()));", "    /// ```", "    #[stable(feature = \"option_deref\", since = \"1.40.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>", "    where", "        T: ~const DerefMut,", "    {", "        match self.as_mut() {", "            Some(t) => Some(t.deref_mut()),", "            None => None,", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Iterator constructors", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns an iterator over the possibly contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(4);", "    /// assert_eq!(x.iter().next(), Some(&4));", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.iter().next(), None);", "    /// ```", "    #[inline]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    pub const fn iter(&self) -> Iter<'_, T> {", "        Iter { inner: Item { opt: self.as_ref() } }", "    }", "", "    /// Returns a mutable iterator over the possibly contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(4);", "    /// match x.iter_mut().next() {", "    ///     Some(v) => *v = 42,", "    ///     None => {},", "    /// }", "    /// assert_eq!(x, Some(42));", "    ///", "    /// let mut x: Option<u32> = None;", "    /// assert_eq!(x.iter_mut().next(), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    pub fn iter_mut(&mut self) -> IterMut<'_, T> {", "        IterMut { inner: Item { opt: self.as_mut() } }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Boolean operations on the values, eager and lazy", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns [`None`] if the option is [`None`], otherwise returns `optb`.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(2);", "    /// let y: Option<&str> = None;", "    /// assert_eq!(x.and(y), None);", "    ///", "    /// let x: Option<u32> = None;", "    /// let y = Some(\"foo\");", "    /// assert_eq!(x.and(y), None);", "    ///", "    /// let x = Some(2);", "    /// let y = Some(\"foo\");", "    /// assert_eq!(x.and(y), Some(\"foo\"));", "    ///", "    /// let x: Option<u32> = None;", "    /// let y: Option<&str> = None;", "    /// assert_eq!(x.and(y), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn and<U>(self, optb: Option<U>) -> Option<U>", "    where", "        T: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match self {", "            Some(_) => optb,", "            None => None,", "        }", "    }", "", "    /// Returns [`None`] if the option is [`None`], otherwise calls `f` with the", "    /// wrapped value and returns the result.", "    ///", "    /// Some languages call this operation flatmap.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// fn sq_then_to_string(x: u32) -> Option<String> {", "    ///     x.checked_mul(x).map(|sq| sq.to_string())", "    /// }", "    ///", "    /// assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string()));", "    /// assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed!", "    /// assert_eq!(None.and_then(sq_then_to_string), None);", "    /// ```", "    ///", "    /// Often used to chain fallible operations that may return [`None`].", "    ///", "    /// ```", "    /// let arr_2d = [[\"A0\", \"A1\"], [\"B0\", \"B1\"]];", "    ///", "    /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1));", "    /// assert_eq!(item_0_1, Some(&\"A1\"));", "    ///", "    /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));", "    /// assert_eq!(item_2_0, None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn and_then<U, F>(self, f: F) -> Option<U>", "    where", "        F: ~const FnOnce(T) -> Option<U>,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => f(x),", "            None => None,", "        }", "    }", "", "    /// Returns [`None`] if the option is [`None`], otherwise calls `predicate`", "    /// with the wrapped value and returns:", "    ///", "    /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped", "    ///   value), and", "    /// - [`None`] if `predicate` returns `false`.", "    ///", "    /// This function works similar to [`Iterator::filter()`]. You can imagine", "    /// the `Option<T>` being an iterator over one or zero elements. `filter()`", "    /// lets you decide which elements to keep.", "    ///", "    /// # Examples", "    ///", "    /// ```rust", "    /// fn is_even(n: &i32) -> bool {", "    ///     n % 2 == 0", "    /// }", "    ///", "    /// assert_eq!(None.filter(is_even), None);", "    /// assert_eq!(Some(3).filter(is_even), None);", "    /// assert_eq!(Some(4).filter(is_even), Some(4));", "    /// ```", "    ///", "    /// [`Some(t)`]: Some", "    #[inline]", "    #[stable(feature = \"option_filter\", since = \"1.27.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn filter<P>(self, predicate: P) -> Self", "    where", "        T: ~const Destruct,", "        P: ~const FnOnce(&T) -> bool,", "        P: ~const Destruct,", "    {", "        if let Some(x) = self {", "            if predicate(&x) {", "                return Some(x);", "            }", "        }", "        None", "    }", "", "    /// Returns the option if it contains a value, otherwise returns `optb`.", "    ///", "    /// Arguments passed to `or` are eagerly evaluated; if you are passing the", "    /// result of a function call, it is recommended to use [`or_else`], which is", "    /// lazily evaluated.", "    ///", "    /// [`or_else`]: Option::or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(2);", "    /// let y = None;", "    /// assert_eq!(x.or(y), Some(2));", "    ///", "    /// let x = None;", "    /// let y = Some(100);", "    /// assert_eq!(x.or(y), Some(100));", "    ///", "    /// let x = Some(2);", "    /// let y = Some(100);", "    /// assert_eq!(x.or(y), Some(2));", "    ///", "    /// let x: Option<u32> = None;", "    /// let y = None;", "    /// assert_eq!(x.or(y), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn or(self, optb: Option<T>) -> Option<T>", "    where", "        T: ~const Destruct,", "    {", "        match self {", "            Some(x) => Some(x),", "            None => optb,", "        }", "    }", "", "    /// Returns the option if it contains a value, otherwise calls `f` and", "    /// returns the result.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// fn nobody() -> Option<&'static str> { None }", "    /// fn vikings() -> Option<&'static str> { Some(\"vikings\") }", "    ///", "    /// assert_eq!(Some(\"barbarians\").or_else(vikings), Some(\"barbarians\"));", "    /// assert_eq!(None.or_else(vikings), Some(\"vikings\"));", "    /// assert_eq!(None.or_else(nobody), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn or_else<F>(self, f: F) -> Option<T>", "    where", "        F: ~const FnOnce() -> Option<T>,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => Some(x),", "            None => f(),", "        }", "    }", "", "    /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(2);", "    /// let y: Option<u32> = None;", "    /// assert_eq!(x.xor(y), Some(2));", "    ///", "    /// let x: Option<u32> = None;", "    /// let y = Some(2);", "    /// assert_eq!(x.xor(y), Some(2));", "    ///", "    /// let x = Some(2);", "    /// let y = Some(2);", "    /// assert_eq!(x.xor(y), None);", "    ///", "    /// let x: Option<u32> = None;", "    /// let y: Option<u32> = None;", "    /// assert_eq!(x.xor(y), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_xor\", since = \"1.37.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn xor(self, optb: Option<T>) -> Option<T>", "    where", "        T: ~const Destruct,", "    {", "        match (self, optb) {", "            (Some(a), None) => Some(a),", "            (None, Some(b)) => Some(b),", "            _ => None,", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Entry-like operations to insert a value and return a reference", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Inserts `value` into the option, then returns a mutable reference to it.", "    ///", "    /// If the option already contains a value, the old value is dropped.", "    ///", "    /// See also [`Option::get_or_insert`], which doesn't update the value if", "    /// the option already contains [`Some`].", "    ///", "    /// # Example", "    ///", "    /// ```", "    /// let mut opt = None;", "    /// let val = opt.insert(1);", "    /// assert_eq!(*val, 1);", "    /// assert_eq!(opt.unwrap(), 1);", "    /// let val = opt.insert(2);", "    /// assert_eq!(*val, 2);", "    /// *val = 3;", "    /// assert_eq!(opt.unwrap(), 3);", "    /// ```", "    #[must_use = \"if you intended to set a value, consider assignment instead\"]", "    #[inline]", "    #[stable(feature = \"option_insert\", since = \"1.53.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn insert(&mut self, value: T) -> &mut T", "    where", "        T: ~const Destruct,", "    {", "        *self = Some(value);", "", "        // SAFETY: the code above just filled the option", "        unsafe { self.as_mut().unwrap_unchecked() }", "    }", "", "    /// Inserts `value` into the option if it is [`None`], then", "    /// returns a mutable reference to the contained value.", "    ///", "    /// See also [`Option::insert`], which updates the value even if", "    /// the option already contains [`Some`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = None;", "    ///", "    /// {", "    ///     let y: &mut u32 = x.get_or_insert(5);", "    ///     assert_eq!(y, &5);", "    ///", "    ///     *y = 7;", "    /// }", "    ///", "    /// assert_eq!(x, Some(7));", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_entry\", since = \"1.20.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn get_or_insert(&mut self, value: T) -> &mut T", "    where", "        T: ~const Destruct,", "    {", "        if let None = *self {", "            *self = Some(value);", "        }", "", "        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`", "        // variant in the code above.", "        unsafe { self.as_mut().unwrap_unchecked() }", "    }", "", "    /// Inserts the default value into the option if it is [`None`], then", "    /// returns a mutable reference to the contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(option_get_or_insert_default)]", "    ///", "    /// let mut x = None;", "    ///", "    /// {", "    ///     let y: &mut u32 = x.get_or_insert_default();", "    ///     assert_eq!(y, &0);", "    ///", "    ///     *y = 7;", "    /// }", "    ///", "    /// assert_eq!(x, Some(7));", "    /// ```", "    #[inline]", "    #[unstable(feature = \"option_get_or_insert_default\", issue = \"82901\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn get_or_insert_default(&mut self) -> &mut T", "    where", "        T: ~const Default,", "    {", "        const fn default<T: ~const Default>() -> T {", "            T::default()", "        }", "", "        self.get_or_insert_with(default)", "    }", "", "    /// Inserts a value computed from `f` into the option if it is [`None`],", "    /// then returns a mutable reference to the contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = None;", "    ///", "    /// {", "    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);", "    ///     assert_eq!(y, &5);", "    ///", "    ///     *y = 7;", "    /// }", "    ///", "    /// assert_eq!(x, Some(7));", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_entry\", since = \"1.20.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T", "    where", "        F: ~const FnOnce() -> T,", "        F: ~const Destruct,", "    {", "        if let None = *self {", "            // the compiler isn't smart enough to know that we are not dropping a `T`", "            // here and wants us to ensure `T` can be dropped at compile time.", "            mem::forget(mem::replace(self, Some(f())))", "        }", "", "        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`", "        // variant in the code above.", "        unsafe { self.as_mut().unwrap_unchecked() }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Misc", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Takes the value out of the option, leaving a [`None`] in its place.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(2);", "    /// let y = x.take();", "    /// assert_eq!(x, None);", "    /// assert_eq!(y, Some(2));", "    ///", "    /// let mut x: Option<u32> = None;", "    /// let y = x.take();", "    /// assert_eq!(x, None);", "    /// assert_eq!(y, None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn take(&mut self) -> Option<T> {", "        // FIXME replace `mem::replace` by `mem::take` when the latter is const ready", "        mem::replace(self, None)", "    }", "", "    /// Replaces the actual value in the option by the value given in parameter,", "    /// returning the old value if present,", "    /// leaving a [`Some`] in its place without deinitializing either one.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(2);", "    /// let old = x.replace(5);", "    /// assert_eq!(x, Some(5));", "    /// assert_eq!(old, Some(2));", "    ///", "    /// let mut x = None;", "    /// let old = x.replace(3);", "    /// assert_eq!(x, Some(3));", "    /// assert_eq!(old, None);", "    /// ```", "    #[inline]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    #[stable(feature = \"option_replace\", since = \"1.31.0\")]", "    pub const fn replace(&mut self, value: T) -> Option<T> {", "        mem::replace(self, Some(value))", "    }", "", "    /// Returns `true` if the option is a [`Some`] value containing the given value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(option_result_contains)]", "    ///", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.contains(&2), true);", "    ///", "    /// let x: Option<u32> = Some(3);", "    /// assert_eq!(x.contains(&2), false);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.contains(&2), false);", "    /// ```", "    #[must_use]", "    #[inline]", "    #[unstable(feature = \"option_result_contains\", issue = \"62358\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn contains<U>(&self, x: &U) -> bool", "    where", "        U: ~const PartialEq<T>,", "    {", "        match self {", "            Some(y) => x.eq(y),", "            None => false,", "        }", "    }", "", "    /// Zips `self` with another `Option`.", "    ///", "    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.", "    /// Otherwise, `None` is returned.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(1);", "    /// let y = Some(\"hi\");", "    /// let z = None::<u8>;", "    ///", "    /// assert_eq!(x.zip(y), Some((1, \"hi\")));", "    /// assert_eq!(x.zip(z), None);", "    /// ```", "    #[stable(feature = \"option_zip_option\", since = \"1.46.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>", "    where", "        T: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match (self, other) {", "            (Some(a), Some(b)) => Some((a, b)),", "            _ => None,", "        }", "    }", "", "    /// Zips `self` and another `Option` with function `f`.", "    ///", "    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`.", "    /// Otherwise, `None` is returned.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(option_zip)]", "    ///", "    /// #[derive(Debug, PartialEq)]", "    /// struct Point {", "    ///     x: f64,", "    ///     y: f64,", "    /// }", "    ///", "    /// impl Point {", "    ///     fn new(x: f64, y: f64) -> Self {", "    ///         Self { x, y }", "    ///     }", "    /// }", "    ///", "    /// let x = Some(17.5);", "    /// let y = Some(42.7);", "    ///", "    /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 }));", "    /// assert_eq!(x.zip_with(None, Point::new), None);", "    /// ```", "    #[unstable(feature = \"option_zip\", issue = \"70086\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>", "    where", "        F: ~const FnOnce(T, U) -> R,", "        F: ~const Destruct,", "        T: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match (self, other) {", "            (Some(a), Some(b)) => Some(f(a, b)),", "            _ => None,", "        }", "    }", "}", "", "impl<T, U> Option<(T, U)> {", "    /// Unzips an option containing a tuple of two options.", "    ///", "    /// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.", "    /// Otherwise, `(None, None)` is returned.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(unzip_option)]", "    ///", "    /// let x = Some((1, \"hi\"));", "    /// let y = None::<(u8, u32)>;", "    ///", "    /// assert_eq!(x.unzip(), (Some(1), Some(\"hi\")));", "    /// assert_eq!(y.unzip(), (None, None));", "    /// ```", "    #[inline]", "    #[unstable(feature = \"unzip_option\", issue = \"87800\", reason = \"recently added\")]", "    pub const fn unzip(self) -> (Option<T>, Option<U>) {", "        match self {", "            Some((a, b)) => (Some(a), Some(b)),", "            None => (None, None),", "        }", "    }", "}", "", "impl<T> Option<&T> {", "    /// Maps an `Option<&T>` to an `Option<T>` by copying the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = 12;", "    /// let opt_x = Some(&x);", "    /// assert_eq!(opt_x, Some(&12));", "    /// let copied = opt_x.copied();", "    /// assert_eq!(copied, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(feature = \"copied\", since = \"1.35.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn copied(self) -> Option<T>", "    where", "        T: Copy,", "    {", "        // FIXME: this implementation, which sidesteps using `Option::map` since it's not const", "        // ready yet, should be reverted when possible to avoid code repetition", "        match self {", "            Some(&v) => Some(v),", "            None => None,", "        }", "    }", "", "    /// Maps an `Option<&T>` to an `Option<T>` by cloning the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = 12;", "    /// let opt_x = Some(&x);", "    /// assert_eq!(opt_x, Some(&12));", "    /// let cloned = opt_x.cloned();", "    /// assert_eq!(cloned, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]", "    pub const fn cloned(self) -> Option<T>", "    where", "        T: ~const Clone,", "    {", "        match self {", "            Some(t) => Some(t.clone()),", "            None => None,", "        }", "    }", "}", "", "impl<T> Option<&mut T> {", "    /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = 12;", "    /// let opt_x = Some(&mut x);", "    /// assert_eq!(opt_x, Some(&mut 12));", "    /// let copied = opt_x.copied();", "    /// assert_eq!(copied, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(feature = \"copied\", since = \"1.35.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn copied(self) -> Option<T>", "    where", "        T: Copy,", "    {", "        match self {", "            Some(&mut t) => Some(t),", "            None => None,", "        }", "    }", "", "    /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = 12;", "    /// let opt_x = Some(&mut x);", "    /// assert_eq!(opt_x, Some(&mut 12));", "    /// let cloned = opt_x.cloned();", "    /// assert_eq!(cloned, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(since = \"1.26.0\", feature = \"option_ref_mut_cloned\")]", "    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]", "    pub const fn cloned(self) -> Option<T>", "    where", "        T: ~const Clone,", "    {", "        match self {", "            Some(t) => Some(t.clone()),", "            None => None,", "        }", "    }", "}", "", "impl<T, E> Option<Result<T, E>> {", "    /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.", "    ///", "    /// [`None`] will be mapped to <code>[Ok]\\([None])</code>.", "    /// <code>[Some]\\([Ok]\\(\\_))</code> and <code>[Some]\\([Err]\\(\\_))</code> will be mapped to", "    /// <code>[Ok]\\([Some]\\(\\_))</code> and <code>[Err]\\(\\_)</code>.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #[derive(Debug, Eq, PartialEq)]", "    /// struct SomeErr;", "    ///", "    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));", "    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));", "    /// assert_eq!(x, y.transpose());", "    /// ```", "    #[inline]", "    #[stable(feature = \"transpose_result\", since = \"1.33.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn transpose(self) -> Result<Option<T>, E> {", "        match self {", "            Some(Ok(x)) => Ok(Some(x)),", "            Some(Err(e)) => Err(e),", "            None => Ok(None),", "        }", "    }", "}", "", "// This is a separate function to reduce the code size of .expect() itself.", "#[cfg_attr(not(feature = \"panic_immediate_abort\"), inline(never))]", "#[cfg_attr(feature = \"panic_immediate_abort\", inline)]", "#[cold]", "#[track_caller]", "#[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "const fn expect_failed(msg: &str) -> ! {", "    panic_str(msg)", "}", "", "/////////////////////////////////////////////////////////////////////////////", "// Trait implementations", "/////////////////////////////////////////////////////////////////////////////", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[rustc_const_unstable(feature = \"const_clone\", issue = \"91805\")]", "impl<T> const Clone for Option<T>", "where", "    T: ~const Clone + ~const Destruct,", "{", "    #[inline]", "    fn clone(&self) -> Self {", "        match self {", "            Some(x) => Some(x.clone()),", "            None => None,", "        }", "    }", "", "    #[inline]", "    fn clone_from(&mut self, source: &Self) {", "        match (self, source) {", "            (Some(to), Some(from)) => to.clone_from(from),", "            (to, from) => *to = from.clone(),", "        }", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[rustc_const_unstable(feature = \"const_default_impls\", issue = \"87864\")]", "impl<T> const Default for Option<T> {", "    /// Returns [`None`][Option::None].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let opt: Option<u32> = Option::default();", "    /// assert!(opt.is_none());", "    /// ```", "    #[inline]", "    fn default() -> Option<T> {", "        None", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<T> IntoIterator for Option<T> {", "    type Item = T;", "    type IntoIter = IntoIter<T>;", "", "    /// Returns a consuming iterator over the possibly contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"string\");", "    /// let v: Vec<&str> = x.into_iter().collect();", "    /// assert_eq!(v, [\"string\"]);", "    ///", "    /// let x = None;", "    /// let v: Vec<&str> = x.into_iter().collect();", "    /// assert!(v.is_empty());", "    /// ```", "    #[inline]", "    fn into_iter(self) -> IntoIter<T> {", "        IntoIter { inner: Item { opt: self } }", "    }", "}", "", "#[stable(since = \"1.4.0\", feature = \"option_iter\")]", "impl<'a, T> IntoIterator for &'a Option<T> {", "    type Item = &'a T;", "    type IntoIter = Iter<'a, T>;", "", "    fn into_iter(self) -> Iter<'a, T> {", "        self.iter()", "    }", "}", "", "#[stable(since = \"1.4.0\", feature = \"option_iter\")]", "impl<'a, T> IntoIterator for &'a mut Option<T> {", "    type Item = &'a mut T;", "    type IntoIter = IterMut<'a, T>;", "", "    fn into_iter(self) -> IterMut<'a, T> {", "        self.iter_mut()", "    }", "}", "", "#[stable(since = \"1.12.0\", feature = \"option_from\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<T> const From<T> for Option<T> {", "    /// Moves `val` into a new [`Some`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let o: Option<u8> = Option::from(67);", "    ///", "    /// assert_eq!(Some(67), o);", "    /// ```", "    fn from(val: T) -> Option<T> {", "        Some(val)", "    }", "}", "", "#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<'a, T> const From<&'a Option<T>> for Option<&'a T> {", "    /// Converts from `&Option<T>` to `Option<&T>`.", "    ///", "    /// # Examples", "    ///", "    /// Converts an <code>[Option]<[String]></code> into an <code>[Option]<[usize]></code>, preserving", "    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,", "    /// so this technique uses `from` to first take an [`Option`] to a reference", "    /// to the value inside the original.", "    ///", "    /// [`map`]: Option::map", "    /// [String]: ../../std/string/struct.String.html \"String\"", "    ///", "    /// ```", "    /// let s: Option<String> = Some(String::from(\"Hello, Rustaceans!\"));", "    /// let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());", "    ///", "    /// println!(\"Can still print s: {s:?}\");", "    ///", "    /// assert_eq!(o, Some(18));", "    /// ```", "    fn from(o: &'a Option<T>) -> Option<&'a T> {", "        o.as_ref()", "    }", "}", "", "#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {", "    /// Converts from `&mut Option<T>` to `Option<&mut T>`", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut s = Some(String::from(\"Hello\"));", "    /// let o: Option<&mut String> = Option::from(&mut s);", "    ///", "    /// match o {", "    ///     Some(t) => *t = String::from(\"Hello, Rustaceans!\"),", "    ///     None => (),", "    /// }", "    ///", "    /// assert_eq!(s, Some(String::from(\"Hello, Rustaceans!\")));", "    /// ```", "    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {", "        o.as_mut()", "    }", "}", "", "/////////////////////////////////////////////////////////////////////////////", "// The Option Iterators", "/////////////////////////////////////////////////////////////////////////////", "", "#[derive(Clone, Debug)]", "struct Item<A> {", "    opt: Option<A>,", "}", "", "impl<A> Iterator for Item<A> {", "    type Item = A;", "", "    #[inline]", "    fn next(&mut self) -> Option<A> {", "        self.opt.take()", "    }", "", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        match self.opt {", "            Some(_) => (1, Some(1)),", "            None => (0, Some(0)),", "        }", "    }", "}", "", "impl<A> DoubleEndedIterator for Item<A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<A> {", "        self.opt.take()", "    }", "}", "", "impl<A> ExactSizeIterator for Item<A> {}", "impl<A> FusedIterator for Item<A> {}", "unsafe impl<A> TrustedLen for Item<A> {}", "", "/// An iterator over a reference to the [`Some`] variant of an [`Option`].", "///", "/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.", "///", "/// This `struct` is created by the [`Option::iter`] function.", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[derive(Debug)]", "pub struct Iter<'a, A: 'a> {", "    inner: Item<&'a A>,", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> Iterator for Iter<'a, A> {", "    type Item = &'a A;", "", "    #[inline]", "    fn next(&mut self) -> Option<&'a A> {", "        self.inner.next()", "    }", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        self.inner.size_hint()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> DoubleEndedIterator for Iter<'a, A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<&'a A> {", "        self.inner.next_back()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> ExactSizeIterator for Iter<'_, A> {}", "", "#[stable(feature = \"fused\", since = \"1.26.0\")]", "impl<A> FusedIterator for Iter<'_, A> {}", "", "#[unstable(feature = \"trusted_len\", issue = \"37572\")]", "unsafe impl<A> TrustedLen for Iter<'_, A> {}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> Clone for Iter<'_, A> {", "    #[inline]", "    fn clone(&self) -> Self {", "        Iter { inner: self.inner.clone() }", "    }", "}", "", "/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].", "///", "/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.", "///", "/// This `struct` is created by the [`Option::iter_mut`] function.", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[derive(Debug)]", "pub struct IterMut<'a, A: 'a> {", "    inner: Item<&'a mut A>,", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> Iterator for IterMut<'a, A> {", "    type Item = &'a mut A;", "", "    #[inline]", "    fn next(&mut self) -> Option<&'a mut A> {", "        self.inner.next()", "    }", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        self.inner.size_hint()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<&'a mut A> {", "        self.inner.next_back()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> ExactSizeIterator for IterMut<'_, A> {}", "", "#[stable(feature = \"fused\", since = \"1.26.0\")]", "impl<A> FusedIterator for IterMut<'_, A> {}", "#[unstable(feature = \"trusted_len\", issue = \"37572\")]", "unsafe impl<A> TrustedLen for IterMut<'_, A> {}", "", "/// An iterator over the value in [`Some`] variant of an [`Option`].", "///", "/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.", "///", "/// This `struct` is created by the [`Option::into_iter`] function.", "#[derive(Clone, Debug)]", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "pub struct IntoIter<A> {", "    inner: Item<A>,", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> Iterator for IntoIter<A> {", "    type Item = A;", "", "    #[inline]", "    fn next(&mut self) -> Option<A> {", "        self.inner.next()", "    }", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        self.inner.size_hint()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> DoubleEndedIterator for IntoIter<A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<A> {", "        self.inner.next_back()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> ExactSizeIterator for IntoIter<A> {}", "", "#[stable(feature = \"fused\", since = \"1.26.0\")]", "impl<A> FusedIterator for IntoIter<A> {}", "", "#[unstable(feature = \"trusted_len\", issue = \"37572\")]", "unsafe impl<A> TrustedLen for IntoIter<A> {}", "", "/////////////////////////////////////////////////////////////////////////////", "// FromIterator", "/////////////////////////////////////////////////////////////////////////////", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {", "    /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],", "    /// no further elements are taken, and the [`None`][Option::None] is", "    /// returned. Should no [`None`][Option::None] occur, a container of type", "    /// `V` containing the values of each [`Option`] is returned.", "    ///", "    /// # Examples", "    ///", "    /// Here is an example which increments every integer in a vector.", "    /// We use the checked variant of `add` that returns `None` when the", "    /// calculation would result in an overflow.", "    ///", "    /// ```", "    /// let items = vec![0_u16, 1, 2];", "    ///", "    /// let res: Option<Vec<u16>> = items", "    ///     .iter()", "    ///     .map(|x| x.checked_add(1))", "    ///     .collect();", "    ///", "    /// assert_eq!(res, Some(vec![1, 2, 3]));", "    /// ```", "    ///", "    /// As you can see, this will return the expected, valid items.", "    ///", "    /// Here is another example that tries to subtract one from another list", "    /// of integers, this time checking for underflow:", "    ///", "    /// ```", "    /// let items = vec![2_u16, 1, 0];", "    ///", "    /// let res: Option<Vec<u16>> = items", "    ///     .iter()", "    ///     .map(|x| x.checked_sub(1))", "    ///     .collect();", "    ///", "    /// assert_eq!(res, None);", "    /// ```", "    ///", "    /// Since the last element is zero, it would underflow. Thus, the resulting", "    /// value is `None`.", "    ///", "    /// Here is a variation on the previous example, showing that no", "    /// further elements are taken from `iter` after the first `None`.", "    ///", "    /// ```", "    /// let items = vec![3_u16, 2, 1, 10];", "    ///", "    /// let mut shared = 0;", "    ///", "    /// let res: Option<Vec<u16>> = items", "    ///     .iter()", "    ///     .map(|x| { shared += x; x.checked_sub(2) })", "    ///     .collect();", "    ///", "    /// assert_eq!(res, None);", "    /// assert_eq!(shared, 6);", "    /// ```", "    ///", "    /// Since the third element caused an underflow, no further elements were taken,", "    /// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.", "    #[inline]", "    fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {", "        // FIXME(#11084): This could be replaced with Iterator::scan when this", "        // performance bug is closed.", "", "        iter::try_process(iter.into_iter(), |i| i.collect())", "    }", "}", "", "#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<T> const ops::Try for Option<T> {", "    type Output = T;", "    type Residual = Option<convert::Infallible>;", "", "    #[inline]", "    fn from_output(output: Self::Output) -> Self {", "        Some(output)", "    }", "", "    #[inline]", "    fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {", "        match self {", "            Some(v) => ControlFlow::Continue(v),", "            None => ControlFlow::Break(None),", "        }", "    }", "}", "", "#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<T> const ops::FromResidual for Option<T> {", "    #[inline]", "    fn from_residual(residual: Option<convert::Infallible>) -> Self {", "        match residual {", "            None => None,", "        }", "    }", "}", "", "#[unstable(feature = \"try_trait_v2_yeet\", issue = \"96374\")]", "impl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {", "    #[inline]", "    fn from_residual(ops::Yeet(()): ops::Yeet<()>) -> Self {", "        None", "    }", "}", "", "#[unstable(feature = \"try_trait_v2_residual\", issue = \"91285\")]", "impl<T> ops::Residual<T> for Option<convert::Infallible> {", "    type TryType = Option<T>;", "}", "", "impl<T> Option<Option<T>> {", "    /// Converts from `Option<Option<T>>` to `Option<T>`.", "    ///", "    /// # Examples", "    ///", "    /// Basic usage:", "    ///", "    /// ```", "    /// let x: Option<Option<u32>> = Some(Some(6));", "    /// assert_eq!(Some(6), x.flatten());", "    ///", "    /// let x: Option<Option<u32>> = Some(None);", "    /// assert_eq!(None, x.flatten());", "    ///", "    /// let x: Option<Option<u32>> = None;", "    /// assert_eq!(None, x.flatten());", "    /// ```", "    ///", "    /// Flattening only removes one level of nesting at a time:", "    ///", "    /// ```", "    /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));", "    /// assert_eq!(Some(Some(6)), x.flatten());", "    /// assert_eq!(Some(6), x.flatten().flatten());", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_flattening\", since = \"1.40.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn flatten(self) -> Option<T> {", "        match self {", "            Some(inner) => inner,", "            None => None,", "        }", "    }", "}", ""]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["s:GetVar('LanguageClient_setOmnifunc', v:true)"],"id":30}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 30, "jsonrpc": "2.0", "result": true}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.text_documents./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> {"languageId":"rust","text":"//! Optional values.\n//!\n//! Type [`Option`] represents an optional value: every [`Option`]\n//! is either [`Some`] and contains a value, or [`None`], and\n//! does not. [`Option`] types are very common in Rust code, as\n//! they have a number of uses:\n//!\n//! * Initial values\n//! * Return values for functions that are not defined\n//!   over their entire input range (partial functions)\n//! * Return value for otherwise reporting simple errors, where [`None`] is\n//!   returned on error\n//! * Optional struct fields\n//! * Struct fields that can be loaned or \"taken\"\n//! * Optional function arguments\n//! * Nullable pointers\n//! * Swapping things out of difficult situations\n//!\n//! [`Option`]s are commonly paired with pattern matching to query the presence\n//! of a value and take action, always accounting for the [`None`] case.\n//!\n//! ```\n//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {\n//!     if denominator == 0.0 {\n//!         None\n//!     } else {\n//!         Some(numerator / denominator)\n//!     }\n//! }\n//!\n//! // The return value of the function is an option\n//! let result = divide(2.0, 3.0);\n//!\n//! // Pattern match to retrieve the value\n//! match result {\n//!     // The division was valid\n//!     Some(x) => println!(\"Result: {x}\"),\n//!     // The division was invalid\n//!     None    => println!(\"Cannot divide by 0\"),\n//! }\n//! ```\n//!\n//\n// FIXME: Show how `Option` is used in practice, with lots of methods\n//\n//! # Options and pointers (\"nullable\" pointers)\n//!\n//! Rust's pointer types must always point to a valid location; there are\n//! no \"null\" references. Instead, Rust has *optional* pointers, like\n//! the optional owned box, <code>[Option]<[Box\\<T>]></code>.\n//!\n//! [Box\\<T>]: ../../std/boxed/struct.Box.html\n//!\n//! The following example uses [`Option`] to create an optional box of\n//! [`i32`]. Notice that in order to use the inner [`i32`] value, the\n//! `check_optional` function first needs to use pattern matching to\n//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or\n//! not ([`None`]).\n//!\n//! ```\n//! let optional = None;\n//! check_optional(optional);\n//!\n//! let optional = Some(Box::new(9000));\n//! check_optional(optional);\n//!\n//! fn check_optional(optional: Option<Box<i32>>) {\n//!     match optional {\n//!         Some(p) => println!(\"has value {p}\"),\n//!         None => println!(\"has no value\"),\n//!     }\n//! }\n//! ```\n//!\n//! # Representation\n//!\n//! Rust guarantees to optimize the following types `T` such that\n//! [`Option<T>`] has the same size as `T`:\n//!\n//! * [`Box<U>`]\n//! * `&U`\n//! * `&mut U`\n//! * `fn`, `extern \"C\" fn`[^extern_fn]\n//! * [`num::NonZero*`]\n//! * [`ptr::NonNull<U>`]\n//! * `#[repr(transparent)]` struct around one of the types in this list.\n//!\n//! [^extern_fn]: this remains true for any other ABI: `extern \"abi\" fn` (_e.g._, `extern \"system\" fn`)\n//!\n//! [`Box<U>`]: ../../std/boxed/struct.Box.html\n//! [`num::NonZero*`]: crate::num\n//! [`ptr::NonNull<U>`]: crate::ptr::NonNull\n//!\n//! This is called the \"null pointer optimization\" or NPO.\n//!\n//! It is further guaranteed that, for the cases above, one can\n//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and\n//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`\n//! is undefined behaviour).\n//!\n//! # Method overview\n//!\n//! In addition to working with pattern matching, [`Option`] provides a wide\n//! variety of different methods.\n//!\n//! ## Querying the variant\n//!\n//! The [`is_some`] and [`is_none`] methods return [`true`] if the [`Option`]\n//! is [`Some`] or [`None`], respectively.\n//!\n//! [`is_none`]: Option::is_none\n//! [`is_some`]: Option::is_some\n//!\n//! ## Adapters for working with references\n//!\n//! * [`as_ref`] converts from <code>[&][][Option]\\<T></code> to <code>[Option]<[&]T></code>\n//! * [`as_mut`] converts from <code>[&mut] [Option]\\<T></code> to <code>[Option]<[&mut] T></code>\n//! * [`as_deref`] converts from <code>[&][][Option]\\<T></code> to\n//!   <code>[Option]<[&]T::[Target]></code>\n//! * [`as_deref_mut`] converts from <code>[&mut] [Option]\\<T></code> to\n//!   <code>[Option]<[&mut] T::[Target]></code>\n//! * [`as_pin_ref`] converts from <code>[Pin]<[&][][Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&]T>></code>\n//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&mut] T>></code>\n//!\n//! [&]: reference \"shared reference\"\n//! [&mut]: reference \"mutable reference\"\n//! [Target]: Deref::Target \"ops::Deref::Target\"\n//! [`as_deref`]: Option::as_deref\n//! [`as_deref_mut`]: Option::as_deref_mut\n//! [`as_mut`]: Option::as_mut\n//! [`as_pin_mut`]: Option::as_pin_mut\n//! [`as_pin_ref`]: Option::as_pin_ref\n//! [`as_ref`]: Option::as_ref\n//!\n//! ## Extracting the contained value\n//!\n//! These methods extract the contained value in an [`Option<T>`] when it\n//! is the [`Some`] variant. If the [`Option`] is [`None`]:\n//!\n//! * [`expect`] panics with a provided custom message\n//! * [`unwrap`] panics with a generic message\n//! * [`unwrap_or`] returns the provided default value\n//! * [`unwrap_or_default`] returns the default value of the type `T`\n//!   (which must implement the [`Default`] trait)\n//! * [`unwrap_or_else`] returns the result of evaluating the provided\n//!   function\n//!\n//! [`expect`]: Option::expect\n//! [`unwrap`]: Option::unwrap\n//! [`unwrap_or`]: Option::unwrap_or\n//! [`unwrap_or_default`]: Option::unwrap_or_default\n//! [`unwrap_or_else`]: Option::unwrap_or_else\n//!\n//! ## Transforming contained values\n//!\n//! These methods transform [`Option`] to [`Result`]:\n//!\n//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   [`Err(err)`] using the provided default `err` value\n//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   a value of [`Err`] using the provided function\n//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a\n//!   [`Result`] of an [`Option`]\n//!\n//! [`Err(err)`]: Err\n//! [`Ok(v)`]: Ok\n//! [`Some(v)`]: Some\n//! [`ok_or`]: Option::ok_or\n//! [`ok_or_else`]: Option::ok_or_else\n//! [`transpose`]: Option::transpose\n//!\n//! These methods transform the [`Some`] variant:\n//!\n//! * [`filter`] calls the provided predicate function on the contained\n//!   value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]\n//!   if the function returns `true`; otherwise, returns [`None`]\n//! * [`flatten`] removes one level of nesting from an\n//!   [`Option<Option<T>>`]\n//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the\n//!   provided function to the contained value of [`Some`] and leaving\n//!   [`None`] values unchanged\n//!\n//! [`Some(t)`]: Some\n//! [`filter`]: Option::filter\n//! [`flatten`]: Option::flatten\n//! [`map`]: Option::map\n//!\n//! These methods transform [`Option<T>`] to a value of a possibly\n//! different type `U`:\n//!\n//! * [`map_or`] applies the provided function to the contained value of\n//!   [`Some`], or returns the provided default value if the [`Option`] is\n//!   [`None`]\n//! * [`map_or_else`] applies the provided function to the contained value\n//!   of [`Some`], or returns the result of evaluating the provided\n//!   fallback function if the [`Option`] is [`None`]\n//!\n//! [`map_or`]: Option::map_or\n//! [`map_or_else`]: Option::map_or_else\n//!\n//! These methods combine the [`Some`] variants of two [`Option`] values:\n//!\n//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the\n//!   provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//! * [`zip_with`] calls the provided function `f` and returns\n//!   [`Some(f(s, o))`] if `self` is [`Some(s)`] and the provided\n//!   [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//!\n//! [`Some(f(s, o))`]: Some\n//! [`Some(o)`]: Some\n//! [`Some(s)`]: Some\n//! [`Some((s, o))`]: Some\n//! [`zip`]: Option::zip\n//! [`zip_with`]: Option::zip_with\n//!\n//! ## Boolean operators\n//!\n//! These methods treat the [`Option`] as a boolean value, where [`Some`]\n//! acts like [`true`] and [`None`] acts like [`false`]. There are two\n//! categories of these methods: ones that take an [`Option`] as input, and\n//! ones that take a function as input (to be lazily evaluated).\n//!\n//! The [`and`], [`or`], and [`xor`] methods take another [`Option`] as\n//! input, and produce an [`Option`] as output. Only the [`and`] method can\n//! produce an [`Option<U>`] value having a different inner type `U` than\n//! [`Option<T>`].\n//!\n//! | method  | self      | input     | output    |\n//! |---------|-----------|-----------|-----------|\n//! | [`and`] | `None`    | (ignored) | `None`    |\n//! | [`and`] | `Some(x)` | `None`    | `None`    |\n//! | [`and`] | `Some(x)` | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `None`    | `None`    | `None`    |\n//! | [`or`]  | `None`    | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `Some(x)` | (ignored) | `Some(x)` |\n//! | [`xor`] | `None`    | `None`    | `None`    |\n//! | [`xor`] | `None`    | `Some(y)` | `Some(y)` |\n//! | [`xor`] | `Some(x)` | `None`    | `Some(x)` |\n//! | [`xor`] | `Some(x)` | `Some(y)` | `None`    |\n//!\n//! [`and`]: Option::and\n//! [`or`]: Option::or\n//! [`xor`]: Option::xor\n//!\n//! The [`and_then`] and [`or_else`] methods take a function as input, and\n//! only evaluate the function when they need to produce a new value. Only\n//! the [`and_then`] method can produce an [`Option<U>`] value having a\n//! different inner type `U` than [`Option<T>`].\n//!\n//! | method       | self      | function input | function result | output    |\n//! |--------------|-----------|----------------|-----------------|-----------|\n//! | [`and_then`] | `None`    | (not provided) | (not evaluated) | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `None`          | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `None`    | (not provided) | `None`          | `None`    |\n//! | [`or_else`]  | `None`    | (not provided) | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `Some(x)` | (not provided) | (not evaluated) | `Some(x)` |\n//!\n//! [`and_then`]: Option::and_then\n//! [`or_else`]: Option::or_else\n//!\n//! This is an example of using methods like [`and_then`] and [`or`] in a\n//! pipeline of method calls. Early stages of the pipeline pass failure\n//! values ([`None`]) through unchanged, and continue processing on\n//! success values ([`Some`]). Toward the end, [`or`] substitutes an error\n//! message if it receives [`None`].\n//!\n//! ```\n//! # use std::collections::BTreeMap;\n//! let mut bt = BTreeMap::new();\n//! bt.insert(20u8, \"foo\");\n//! bt.insert(42u8, \"bar\");\n//! let res = [0u8, 1, 11, 200, 22]\n//!     .into_iter()\n//!     .map(|x| {\n//!         // `checked_sub()` returns `None` on error\n//!         x.checked_sub(1)\n//!             // same with `checked_mul()`\n//!             .and_then(|x| x.checked_mul(2))\n//!             // `BTreeMap::get` returns `None` on error\n//!             .and_then(|x| bt.get(&x))\n//!             // Substitute an error message if we have `None` so far\n//!             .or(Some(&\"error!\"))\n//!             .copied()\n//!             // Won't panic because we unconditionally used `Some` above\n//!             .unwrap()\n//!     })\n//!     .collect::<Vec<_>>();\n//! assert_eq!(res, [\"error!\", \"error!\", \"foo\", \"error!\", \"bar\"]);\n//! ```\n//!\n//! ## Comparison operators\n//!\n//! If `T` implements [`PartialOrd`] then [`Option<T>`] will derive its\n//! [`PartialOrd`] implementation.  With this order, [`None`] compares as\n//! less than any [`Some`], and two [`Some`] compare the same way as their\n//! contained values would in `T`.  If `T` also implements\n//! [`Ord`], then so does [`Option<T>`].\n//!\n//! ```\n//! assert!(None < Some(0));\n//! assert!(Some(0) < Some(1));\n//! ```\n//!\n//! ## Iterating over `Option`\n//!\n//! An [`Option`] can be iterated over. This can be helpful if you need an\n//! iterator that is conditionally empty. The iterator will either produce\n//! a single value (when the [`Option`] is [`Some`]), or produce no values\n//! (when the [`Option`] is [`None`]). For example, [`into_iter`] acts like\n//! [`once(v)`] if the [`Option`] is [`Some(v)`], and like [`empty()`] if\n//! the [`Option`] is [`None`].\n//!\n//! [`Some(v)`]: Some\n//! [`empty()`]: crate::iter::empty\n//! [`once(v)`]: crate::iter::once\n//!\n//! Iterators over [`Option<T>`] come in three types:\n//!\n//! * [`into_iter`] consumes the [`Option`] and produces the contained\n//!   value\n//! * [`iter`] produces an immutable reference of type `&T` to the\n//!   contained value\n//! * [`iter_mut`] produces a mutable reference of type `&mut T` to the\n//!   contained value\n//!\n//! [`into_iter`]: Option::into_iter\n//! [`iter`]: Option::iter\n//! [`iter_mut`]: Option::iter_mut\n//!\n//! An iterator over [`Option`] can be useful when chaining iterators, for\n//! example, to conditionally insert items. (It's not always necessary to\n//! explicitly call an iterator constructor: many [`Iterator`] methods that\n//! accept other iterators will also accept iterable types that implement\n//! [`IntoIterator`], which includes [`Option`].)\n//!\n//! ```\n//! let yep = Some(42);\n//! let nope = None;\n//! // chain() already calls into_iter(), so we don't have to do so\n//! let nums: Vec<i32> = (0..4).chain(yep).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 42, 4, 5, 6, 7]);\n//! let nums: Vec<i32> = (0..4).chain(nope).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 4, 5, 6, 7]);\n//! ```\n//!\n//! One reason to chain iterators in this way is that a function returning\n//! `impl Iterator` must have all possible return values be of the same\n//! concrete type. Chaining an iterated [`Option`] can help with that.\n//!\n//! ```\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types matching\n//!     match do_insert {\n//!         true => return (0..4).chain(Some(42)).chain(4..8),\n//!         false => return (0..4).chain(None).chain(4..8),\n//!     }\n//! }\n//! println!(\"{:?}\", make_iter(true).collect::<Vec<_>>());\n//! println!(\"{:?}\", make_iter(false).collect::<Vec<_>>());\n//! ```\n//!\n//! If we try to do the same thing, but using [`once()`] and [`empty()`],\n//! we can't return `impl Iterator` anymore because the concrete types of\n//! the return values differ.\n//!\n//! [`empty()`]: crate::iter::empty\n//! [`once()`]: crate::iter::once\n//!\n//! ```compile_fail,E0308\n//! # use std::iter::{empty, once};\n//! // This won't compile because all possible returns from the function\n//! // must have the same concrete type.\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types not matching\n//!     match do_insert {\n//!         true => return (0..4).chain(once(42)).chain(4..8),\n//!         false => return (0..4).chain(empty()).chain(4..8),\n//!     }\n//! }\n//! ```\n//!\n//! ## Collecting into `Option`\n//!\n//! [`Option`] implements the [`FromIterator`][impl-FromIterator] trait,\n//! which allows an iterator over [`Option`] values to be collected into an\n//! [`Option`] of a collection of each contained value of the original\n//! [`Option`] values, or [`None`] if any of the elements was [`None`].\n//!\n//! [impl-FromIterator]: Option#impl-FromIterator%3COption%3CA%3E%3E\n//!\n//! ```\n//! let v = [Some(2), Some(4), None, Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, None);\n//! let v = [Some(2), Some(4), Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, Some(vec![2, 4, 8]));\n//! ```\n//!\n//! [`Option`] also implements the [`Product`][impl-Product] and\n//! [`Sum`][impl-Sum] traits, allowing an iterator over [`Option`] values\n//! to provide the [`product`][Iterator::product] and\n//! [`sum`][Iterator::sum] methods.\n//!\n//! [impl-Product]: Option#impl-Product%3COption%3CU%3E%3E\n//! [impl-Sum]: Option#impl-Sum%3COption%3CU%3E%3E\n//!\n//! ```\n//! let v = [None, Some(1), Some(2), Some(3)];\n//! let res: Option<i32> = v.into_iter().sum();\n//! assert_eq!(res, None);\n//! let v = [Some(1), Some(2), Some(21)];\n//! let res: Option<i32> = v.into_iter().product();\n//! assert_eq!(res, Some(42));\n//! ```\n//!\n//! ## Modifying an [`Option`] in-place\n//!\n//! These methods return a mutable reference to the contained value of an\n//! [`Option<T>`]:\n//!\n//! * [`insert`] inserts a value, dropping any old contents\n//! * [`get_or_insert`] gets the current value, inserting a provided\n//!   default value if it is [`None`]\n//! * [`get_or_insert_default`] gets the current value, inserting the\n//!   default value of type `T` (which must implement [`Default`]) if it is\n//!   [`None`]\n//! * [`get_or_insert_with`] gets the current value, inserting a default\n//!   computed by the provided function if it is [`None`]\n//!\n//! [`get_or_insert`]: Option::get_or_insert\n//! [`get_or_insert_default`]: Option::get_or_insert_default\n//! [`get_or_insert_with`]: Option::get_or_insert_with\n//! [`insert`]: Option::insert\n//!\n//! These methods transfer ownership of the contained value of an\n//! [`Option`]:\n//!\n//! * [`take`] takes ownership of the contained value of an [`Option`], if\n//!   any, replacing the [`Option`] with [`None`]\n//! * [`replace`] takes ownership of the contained value of an [`Option`],\n//!   if any, replacing the [`Option`] with a [`Some`] containing the\n//!   provided value\n//!\n//! [`replace`]: Option::replace\n//! [`take`]: Option::take\n//!\n//! # Examples\n//!\n//! Basic pattern matching on [`Option`]:\n//!\n//! ```\n//! let msg = Some(\"howdy\");\n//!\n//! // Take a reference to the contained string\n//! if let Some(m) = &msg {\n//!     println!(\"{}\", *m);\n//! }\n//!\n//! // Remove the contained string, destroying the Option\n//! let unwrapped_msg = msg.unwrap_or(\"default message\");\n//! ```\n//!\n//! Initialize a result to [`None`] before a loop:\n//!\n//! ```\n//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }\n//!\n//! // A list of data to search through.\n//! let all_the_big_things = [\n//!     Kingdom::Plant(250, \"redwood\"),\n//!     Kingdom::Plant(230, \"noble fir\"),\n//!     Kingdom::Plant(229, \"sugar pine\"),\n//!     Kingdom::Animal(25, \"blue whale\"),\n//!     Kingdom::Animal(19, \"fin whale\"),\n//!     Kingdom::Animal(15, \"north pacific right whale\"),\n//! ];\n//!\n//! // We're going to search for the name of the biggest animal,\n//! // but to start with we've just got `None`.\n//! let mut name_of_biggest_animal = None;\n//! let mut size_of_biggest_animal = 0;\n//! for big_thing in &all_the_big_things {\n//!     match *big_thing {\n//!         Kingdom::Animal(size, name) if size > size_of_biggest_animal => {\n//!             // Now we've found the name of some big animal\n//!             size_of_biggest_animal = size;\n//!             name_of_biggest_animal = Some(name);\n//!         }\n//!         Kingdom::Animal(..) | Kingdom::Plant(..) => ()\n//!     }\n//! }\n//!\n//! match name_of_biggest_animal {\n//!     Some(name) => println!(\"the biggest animal is {name}\"),\n//!     None => println!(\"there are no animals :(\"),\n//! }\n//! ```\n\n#![stable(feature = \"rust1\", since = \"1.0.0\")]\n\nuse crate::iter::{self, FromIterator, FusedIterator, TrustedLen};\nuse crate::marker::Destruct;\nuse crate::panicking::{panic, panic_str};\nuse crate::pin::Pin;\nuse crate::{\n    convert, hint, mem,\n    ops::{self, ControlFlow, Deref, DerefMut},\n};\n\n/// The `Option` type. See [the module level documentation](self) for more.\n#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]\n#[rustc_diagnostic_item = \"Option\"]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub enum Option<T> {\n    /// No value.\n    #[lang = \"None\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    None,\n    /// Some value of type `T`.\n    #[lang = \"Some\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    Some(#[stable(feature = \"rust1\", since = \"1.0.0\")] T),\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Type implementation\n/////////////////////////////////////////////////////////////////////////////\n\nimpl<T> Option<T> {\n    /////////////////////////////////////////////////////////////////////////\n    // Querying the contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns `true` if the option is a [`Some`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some(), true);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some(), false);\n    /// ```\n    #[must_use = \"if you intended to assert that this has a value, consider `.unwrap()` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_some(&self) -> bool {\n        matches!(*self, Some(_))\n    }\n\n    /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(is_some_with)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), true);\n    ///\n    /// let x: Option<u32> = Some(0);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"is_some_with\", issue = \"93050\")]\n    pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool {\n        matches!(self, Some(x) if f(x))\n    }\n\n    /// Returns `true` if the option is a [`None`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_none(), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_none(), true);\n    /// ```\n    #[must_use = \"if you intended to assert that this doesn't have a value, consider \\\n                  `.and_then(|_| panic!(\\\"`Option` had a value when expected `None`\\\"))` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_none(&self) -> bool {\n        !self.is_some()\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Adapter for working with references\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `as_ref` to first take an `Option` to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let text: Option<String> = Some(\"Hello, world!\".to_string());\n    /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,\n    /// // then consume *that* with `map`, leaving `text` on the stack.\n    /// let text_length: Option<usize> = text.as_ref().map(|s| s.len());\n    /// println!(\"still can print text: {text:?}\");\n    /// ```\n    #[inline]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn as_ref(&self) -> Option<&T> {\n        match *self {\n            Some(ref x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// match x.as_mut() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn as_mut(&mut self) -> Option<&mut T> {\n        match *self {\n            Some(ref mut x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&]Option\\<T>></code> to <code>Option<[Pin]<[&]T>></code>.\n    ///\n    /// [&]: reference \"shared reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {\n        match Pin::get_ref(self).as_ref() {\n            // SAFETY: `x` is guaranteed to be pinned because it comes from `self`\n            // which is pinned.\n            Some(x) => unsafe { Some(Pin::new_unchecked(x)) },\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&mut] Option\\<T>></code> to <code>Option<[Pin]<[&mut] T>></code>.\n    ///\n    /// [&mut]: reference \"mutable reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {\n        // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.\n        // `x` is guaranteed to be pinned because it comes from `self` which is pinned.\n        unsafe {\n            match Pin::get_unchecked_mut(self).as_mut() {\n                Some(x) => Some(Pin::new_unchecked(x)),\n                None => None,\n            }\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Getting to contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the value is a [`None`] with a custom panic message provided by\n    /// `msg`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"value\");\n    /// assert_eq!(x.expect(\"fruits are healthy\"), \"value\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// x.expect(\"fruits are healthy\"); // panics with `fruits are healthy`\n    /// ```\n    ///\n    /// # Recommended Message Style\n    ///\n    /// We recommend that `expect` messages are used to describe the reason you\n    /// _expect_ the `Option` should be `Some`.\n    ///\n    /// ```should_panic\n    /// # let slice: &[u8] = &[];\n    /// let item = slice.get(0)\n    ///     .expect(\"slice should not be empty\");\n    /// ```\n    ///\n    /// **Hint**: If you're having trouble remembering how to phrase expect\n    /// error messages remember to focus on the word \"should\" as in \"env\n    /// variable should be set by blah\" or \"the given binary should be available\n    /// and executable by the current user\".\n    ///\n    /// For more detail on expect message styles and the reasoning behind our\n    /// recommendation please refer to the section on [\"Common Message\n    /// Styles\"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs.\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn expect(self, msg: &str) -> T {\n        match self {\n            Some(val) => val,\n            None => expect_failed(msg),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// Because this function may panic, its use is generally discouraged.\n    /// Instead, prefer to use pattern matching and handle the [`None`]\n    /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or\n    /// [`unwrap_or_default`].\n    ///\n    /// [`unwrap_or`]: Option::unwrap_or\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    /// [`unwrap_or_default`]: Option::unwrap_or_default\n    ///\n    /// # Panics\n    ///\n    /// Panics if the self value equals [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(x.unwrap(), \"air\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.unwrap(), \"air\"); // fails\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn unwrap(self) -> T {\n        match self {\n            Some(val) => val,\n            None => panic(\"called `Option::unwrap()` on a `None` value\"),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a provided default.\n    ///\n    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`unwrap_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// assert_eq!(Some(\"car\").unwrap_or(\"bike\"), \"car\");\n    /// assert_eq!(None.unwrap_or(\"bike\"), \"bike\");\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or(self, default: T) -> T\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => default,\n        }\n    }\n\n    /// Returns the contained [`Some`] value or computes it from a closure.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 10;\n    /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);\n    /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_else<F>(self, f: F) -> T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => f(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a default.\n    ///\n    /// Consumes the `self` argument then, if [`Some`], returns the contained\n    /// value, otherwise if [`None`], returns the [default value] for that\n    /// type.\n    ///\n    /// # Examples\n    ///\n    /// Converts a string to an integer, turning poorly-formed strings\n    /// into 0 (the default value for integers). [`parse`] converts\n    /// a string to any other type that implements [`FromStr`], returning\n    /// [`None`] on error.\n    ///\n    /// ```\n    /// let good_year_from_input = \"1909\";\n    /// let bad_year_from_input = \"190blarg\";\n    /// let good_year = good_year_from_input.parse().ok().unwrap_or_default();\n    /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();\n    ///\n    /// assert_eq!(1909, good_year);\n    /// assert_eq!(0, bad_year);\n    /// ```\n    ///\n    /// [default value]: Default::default\n    /// [`parse`]: str::parse\n    /// [`FromStr`]: crate::str::FromStr\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_default(self) -> T\n    where\n        T: ~const Default,\n    {\n        match self {\n            Some(x) => x,\n            None => Default::default(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value,\n    /// without checking that the value is not [`None`].\n    ///\n    /// # Safety\n    ///\n    /// Calling this method on [`None`] is *[undefined behavior]*.\n    ///\n    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\");\n    /// ```\n    ///\n    /// ```no_run\n    /// let x: Option<&str> = None;\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\"); // Undefined behavior!\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"option_result_unwrap_unchecked\", since = \"1.58.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const unsafe fn unwrap_unchecked(self) -> T {\n        debug_assert!(self.is_some());\n        match self {\n            Some(val) => val,\n            // SAFETY: the safety contract must be upheld by the caller.\n            None => unsafe { hint::unreachable_unchecked() },\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Transforming contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming\n    /// the original:\n    ///\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    /// ```\n    /// let maybe_some_string = Some(String::from(\"Hello, World!\"));\n    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`\n    /// let maybe_some_len = maybe_some_string.map(|s| s.len());\n    ///\n    /// assert_eq!(maybe_some_len, Some(13));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(f(x)),\n            None => None,\n        }\n    }\n\n    /// Calls the provided closure with a reference to the contained value (if [`Some`]).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(result_option_inspect)]\n    ///\n    /// let v = vec![1, 2, 3, 4, 5];\n    ///\n    /// // prints \"got: 4\"\n    /// let x: Option<&usize> = v.get(3).inspect(|x| println!(\"got: {x}\"));\n    ///\n    /// // prints nothing\n    /// let x: Option<&usize> = v.get(5).inspect(|x| println!(\"got: {x}\"));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"result_option_inspect\", issue = \"91345\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn inspect<F>(self, f: F) -> Self\n    where\n        F: ~const FnOnce(&T),\n        F: ~const Destruct,\n    {\n        if let Some(ref x) = self {\n            f(x);\n        }\n\n        self\n    }\n\n    /// Returns the provided default result (if none),\n    /// or applies a function to the contained value (if any).\n    ///\n    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`map_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`map_or_else`]: Option::map_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or(42, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or(42, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or<U, F>(self, default: U, f: F) -> U\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default,\n        }\n    }\n\n    /// Computes a default function result (if none), or\n    /// applies a different function to the contained value (if any).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 21;\n    ///\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U\n    where\n        D: ~const FnOnce() -> U,\n        D: ~const Destruct,\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default(),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err)`].\n    ///\n    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`ok_or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err)`]: Err\n    /// [`Some(v)`]: Some\n    /// [`ok_or_else`]: Option::ok_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or(0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or(0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or<E>(self, err: E) -> Result<T, E>\n    where\n        E: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err())`].\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err())`]: Err\n    /// [`Some(v)`]: Some\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or_else(|| 0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or_else(|| 0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>\n    where\n        F: ~const FnOnce() -> E,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err()),\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.\n    ///\n    /// Leaves the original Option in-place, creating a new one with a reference\n    /// to the original one, additionally coercing the contents via [`Deref`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref(), Some(\"hey\"));\n    ///\n    /// let x: Option<String> = None;\n    /// assert_eq!(x.as_deref(), None);\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref(&self) -> Option<&T::Target>\n    where\n        T: ~const Deref,\n    {\n        match self.as_ref() {\n            Some(t) => Some(t.deref()),\n            None => None,\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.\n    ///\n    /// Leaves the original `Option` in-place, creating a new one containing a mutable reference to\n    /// the inner type's [`Deref::Target`] type.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref_mut().map(|x| {\n    ///     x.make_ascii_uppercase();\n    ///     x\n    /// }), Some(\"HEY\".to_owned().as_mut_str()));\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>\n    where\n        T: ~const DerefMut,\n    {\n        match self.as_mut() {\n            Some(t) => Some(t.deref_mut()),\n            None => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Iterator constructors\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns an iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(4);\n    /// assert_eq!(x.iter().next(), Some(&4));\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.iter().next(), None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn iter(&self) -> Iter<'_, T> {\n        Iter { inner: Item { opt: self.as_ref() } }\n    }\n\n    /// Returns a mutable iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(4);\n    /// match x.iter_mut().next() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// assert_eq!(x.iter_mut().next(), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub fn iter_mut(&mut self) -> IterMut<'_, T> {\n        IterMut { inner: Item { opt: self.as_mut() } }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Boolean operations on the values, eager and lazy\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns [`None`] if the option is [`None`], otherwise returns `optb`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x = Some(2);\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), Some(\"foo\"));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and<U>(self, optb: Option<U>) -> Option<U>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(_) => optb,\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `f` with the\n    /// wrapped value and returns the result.\n    ///\n    /// Some languages call this operation flatmap.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn sq_then_to_string(x: u32) -> Option<String> {\n    ///     x.checked_mul(x).map(|sq| sq.to_string())\n    /// }\n    ///\n    /// assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string()));\n    /// assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed!\n    /// assert_eq!(None.and_then(sq_then_to_string), None);\n    /// ```\n    ///\n    /// Often used to chain fallible operations that may return [`None`].\n    ///\n    /// ```\n    /// let arr_2d = [[\"A0\", \"A1\"], [\"B0\", \"B1\"]];\n    ///\n    /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1));\n    /// assert_eq!(item_0_1, Some(&\"A1\"));\n    ///\n    /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));\n    /// assert_eq!(item_2_0, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and_then<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> Option<U>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => f(x),\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `predicate`\n    /// with the wrapped value and returns:\n    ///\n    /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped\n    ///   value), and\n    /// - [`None`] if `predicate` returns `false`.\n    ///\n    /// This function works similar to [`Iterator::filter()`]. You can imagine\n    /// the `Option<T>` being an iterator over one or zero elements. `filter()`\n    /// lets you decide which elements to keep.\n    ///\n    /// # Examples\n    ///\n    /// ```rust\n    /// fn is_even(n: &i32) -> bool {\n    ///     n % 2 == 0\n    /// }\n    ///\n    /// assert_eq!(None.filter(is_even), None);\n    /// assert_eq!(Some(3).filter(is_even), None);\n    /// assert_eq!(Some(4).filter(is_even), Some(4));\n    /// ```\n    ///\n    /// [`Some(t)`]: Some\n    #[inline]\n    #[stable(feature = \"option_filter\", since = \"1.27.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn filter<P>(self, predicate: P) -> Self\n    where\n        T: ~const Destruct,\n        P: ~const FnOnce(&T) -> bool,\n        P: ~const Destruct,\n    {\n        if let Some(x) = self {\n            if predicate(&x) {\n                return Some(x);\n            }\n        }\n        None\n    }\n\n    /// Returns the option if it contains a value, otherwise returns `optb`.\n    ///\n    /// Arguments passed to `or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`or_else`]: Option::or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y = None;\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x = None;\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(100));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = None;\n    /// assert_eq!(x.or(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => optb,\n        }\n    }\n\n    /// Returns the option if it contains a value, otherwise calls `f` and\n    /// returns the result.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn nobody() -> Option<&'static str> { None }\n    /// fn vikings() -> Option<&'static str> { Some(\"vikings\") }\n    ///\n    /// assert_eq!(Some(\"barbarians\").or_else(vikings), Some(\"barbarians\"));\n    /// assert_eq!(None.or_else(vikings), Some(\"vikings\"));\n    /// assert_eq!(None.or_else(nobody), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or_else<F>(self, f: F) -> Option<T>\n    where\n        F: ~const FnOnce() -> Option<T>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => f(),\n        }\n    }\n\n    /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_xor\", since = \"1.37.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn xor(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match (self, optb) {\n            (Some(a), None) => Some(a),\n            (None, Some(b)) => Some(b),\n            _ => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Entry-like operations to insert a value and return a reference\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Inserts `value` into the option, then returns a mutable reference to it.\n    ///\n    /// If the option already contains a value, the old value is dropped.\n    ///\n    /// See also [`Option::get_or_insert`], which doesn't update the value if\n    /// the option already contains [`Some`].\n    ///\n    /// # Example\n    ///\n    /// ```\n    /// let mut opt = None;\n    /// let val = opt.insert(1);\n    /// assert_eq!(*val, 1);\n    /// assert_eq!(opt.unwrap(), 1);\n    /// let val = opt.insert(2);\n    /// assert_eq!(*val, 2);\n    /// *val = 3;\n    /// assert_eq!(opt.unwrap(), 3);\n    /// ```\n    #[must_use = \"if you intended to set a value, consider assignment instead\"]\n    #[inline]\n    #[stable(feature = \"option_insert\", since = \"1.53.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        *self = Some(value);\n\n        // SAFETY: the code above just filled the option\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts `value` into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// See also [`Option::insert`], which updates the value even if\n    /// the option already contains [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert(5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        if let None = *self {\n            *self = Some(value);\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts the default value into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_get_or_insert_default)]\n    ///\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_default();\n    ///     assert_eq!(y, &0);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"option_get_or_insert_default\", issue = \"82901\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_default(&mut self) -> &mut T\n    where\n        T: ~const Default,\n    {\n        const fn default<T: ~const Default>() -> T {\n            T::default()\n        }\n\n        self.get_or_insert_with(default)\n    }\n\n    /// Inserts a value computed from `f` into the option if it is [`None`],\n    /// then returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        if let None = *self {\n            // the compiler isn't smart enough to know that we are not dropping a `T`\n            // here and wants us to ensure `T` can be dropped at compile time.\n            mem::forget(mem::replace(self, Some(f())))\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Misc\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Takes the value out of the option, leaving a [`None`] in its place.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, Some(2));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn take(&mut self) -> Option<T> {\n        // FIXME replace `mem::replace` by `mem::take` when the latter is const ready\n        mem::replace(self, None)\n    }\n\n    /// Replaces the actual value in the option by the value given in parameter,\n    /// returning the old value if present,\n    /// leaving a [`Some`] in its place without deinitializing either one.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let old = x.replace(5);\n    /// assert_eq!(x, Some(5));\n    /// assert_eq!(old, Some(2));\n    ///\n    /// let mut x = None;\n    /// let old = x.replace(3);\n    /// assert_eq!(x, Some(3));\n    /// assert_eq!(old, None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"option_replace\", since = \"1.31.0\")]\n    pub const fn replace(&mut self, value: T) -> Option<T> {\n        mem::replace(self, Some(value))\n    }\n\n    /// Returns `true` if the option is a [`Some`] value containing the given value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_result_contains)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.contains(&2), true);\n    ///\n    /// let x: Option<u32> = Some(3);\n    /// assert_eq!(x.contains(&2), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.contains(&2), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"option_result_contains\", issue = \"62358\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn contains<U>(&self, x: &U) -> bool\n    where\n        U: ~const PartialEq<T>,\n    {\n        match self {\n            Some(y) => x.eq(y),\n            None => false,\n        }\n    }\n\n    /// Zips `self` with another `Option`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(1);\n    /// let y = Some(\"hi\");\n    /// let z = None::<u8>;\n    ///\n    /// assert_eq!(x.zip(y), Some((1, \"hi\")));\n    /// assert_eq!(x.zip(z), None);\n    /// ```\n    #[stable(feature = \"option_zip_option\", since = \"1.46.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some((a, b)),\n            _ => None,\n        }\n    }\n\n    /// Zips `self` and another `Option` with function `f`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_zip)]\n    ///\n    /// #[derive(Debug, PartialEq)]\n    /// struct Point {\n    ///     x: f64,\n    ///     y: f64,\n    /// }\n    ///\n    /// impl Point {\n    ///     fn new(x: f64, y: f64) -> Self {\n    ///         Self { x, y }\n    ///     }\n    /// }\n    ///\n    /// let x = Some(17.5);\n    /// let y = Some(42.7);\n    ///\n    /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 }));\n    /// assert_eq!(x.zip_with(None, Point::new), None);\n    /// ```\n    #[unstable(feature = \"option_zip\", issue = \"70086\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>\n    where\n        F: ~const FnOnce(T, U) -> R,\n        F: ~const Destruct,\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some(f(a, b)),\n            _ => None,\n        }\n    }\n}\n\nimpl<T, U> Option<(T, U)> {\n    /// Unzips an option containing a tuple of two options.\n    ///\n    /// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.\n    /// Otherwise, `(None, None)` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(unzip_option)]\n    ///\n    /// let x = Some((1, \"hi\"));\n    /// let y = None::<(u8, u32)>;\n    ///\n    /// assert_eq!(x.unzip(), (Some(1), Some(\"hi\")));\n    /// assert_eq!(y.unzip(), (None, None));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"unzip_option\", issue = \"87800\", reason = \"recently added\")]\n    pub const fn unzip(self) -> (Option<T>, Option<U>) {\n        match self {\n            Some((a, b)) => (Some(a), Some(b)),\n            None => (None, None),\n        }\n    }\n}\n\nimpl<T> Option<&T> {\n    /// Maps an `Option<&T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        // FIXME: this implementation, which sidesteps using `Option::map` since it's not const\n        // ready yet, should be reverted when possible to avoid code repetition\n        match self {\n            Some(&v) => Some(v),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T> Option<&mut T> {\n    /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        match self {\n            Some(&mut t) => Some(t),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(since = \"1.26.0\", feature = \"option_ref_mut_cloned\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T, E> Option<Result<T, E>> {\n    /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.\n    ///\n    /// [`None`] will be mapped to <code>[Ok]\\([None])</code>.\n    /// <code>[Some]\\([Ok]\\(\\_))</code> and <code>[Some]\\([Err]\\(\\_))</code> will be mapped to\n    /// <code>[Ok]\\([Some]\\(\\_))</code> and <code>[Err]\\(\\_)</code>.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #[derive(Debug, Eq, PartialEq)]\n    /// struct SomeErr;\n    ///\n    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));\n    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));\n    /// assert_eq!(x, y.transpose());\n    /// ```\n    #[inline]\n    #[stable(feature = \"transpose_result\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn transpose(self) -> Result<Option<T>, E> {\n        match self {\n            Some(Ok(x)) => Ok(Some(x)),\n            Some(Err(e)) => Err(e),\n            None => Ok(None),\n        }\n    }\n}\n\n// This is a separate function to reduce the code size of .expect() itself.\n#[cfg_attr(not(feature = \"panic_immediate_abort\"), inline(never))]\n#[cfg_attr(feature = \"panic_immediate_abort\", inline)]\n#[cold]\n#[track_caller]\n#[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\nconst fn expect_failed(msg: &str) -> ! {\n    panic_str(msg)\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Trait implementations\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_clone\", issue = \"91805\")]\nimpl<T> const Clone for Option<T>\nwhere\n    T: ~const Clone + ~const Destruct,\n{\n    #[inline]\n    fn clone(&self) -> Self {\n        match self {\n            Some(x) => Some(x.clone()),\n            None => None,\n        }\n    }\n\n    #[inline]\n    fn clone_from(&mut self, source: &Self) {\n        match (self, source) {\n            (Some(to), Some(from)) => to.clone_from(from),\n            (to, from) => *to = from.clone(),\n        }\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_default_impls\", issue = \"87864\")]\nimpl<T> const Default for Option<T> {\n    /// Returns [`None`][Option::None].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let opt: Option<u32> = Option::default();\n    /// assert!(opt.is_none());\n    /// ```\n    #[inline]\n    fn default() -> Option<T> {\n        None\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<T> IntoIterator for Option<T> {\n    type Item = T;\n    type IntoIter = IntoIter<T>;\n\n    /// Returns a consuming iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"string\");\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert_eq!(v, [\"string\"]);\n    ///\n    /// let x = None;\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert!(v.is_empty());\n    /// ```\n    #[inline]\n    fn into_iter(self) -> IntoIter<T> {\n        IntoIter { inner: Item { opt: self } }\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a Option<T> {\n    type Item = &'a T;\n    type IntoIter = Iter<'a, T>;\n\n    fn into_iter(self) -> Iter<'a, T> {\n        self.iter()\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a mut Option<T> {\n    type Item = &'a mut T;\n    type IntoIter = IterMut<'a, T>;\n\n    fn into_iter(self) -> IterMut<'a, T> {\n        self.iter_mut()\n    }\n}\n\n#[stable(since = \"1.12.0\", feature = \"option_from\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const From<T> for Option<T> {\n    /// Moves `val` into a new [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let o: Option<u8> = Option::from(67);\n    ///\n    /// assert_eq!(Some(67), o);\n    /// ```\n    fn from(val: T) -> Option<T> {\n        Some(val)\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a Option<T>> for Option<&'a T> {\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>[Option]<[String]></code> into an <code>[Option]<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `from` to first take an [`Option`] to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let s: Option<String> = Some(String::from(\"Hello, Rustaceans!\"));\n    /// let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());\n    ///\n    /// println!(\"Can still print s: {s:?}\");\n    ///\n    /// assert_eq!(o, Some(18));\n    /// ```\n    fn from(o: &'a Option<T>) -> Option<&'a T> {\n        o.as_ref()\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut s = Some(String::from(\"Hello\"));\n    /// let o: Option<&mut String> = Option::from(&mut s);\n    ///\n    /// match o {\n    ///     Some(t) => *t = String::from(\"Hello, Rustaceans!\"),\n    ///     None => (),\n    /// }\n    ///\n    /// assert_eq!(s, Some(String::from(\"Hello, Rustaceans!\")));\n    /// ```\n    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {\n        o.as_mut()\n    }\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// The Option Iterators\n/////////////////////////////////////////////////////////////////////////////\n\n#[derive(Clone, Debug)]\nstruct Item<A> {\n    opt: Option<A>,\n}\n\nimpl<A> Iterator for Item<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        match self.opt {\n            Some(_) => (1, Some(1)),\n            None => (0, Some(0)),\n        }\n    }\n}\n\nimpl<A> DoubleEndedIterator for Item<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n}\n\nimpl<A> ExactSizeIterator for Item<A> {}\nimpl<A> FusedIterator for Item<A> {}\nunsafe impl<A> TrustedLen for Item<A> {}\n\n/// An iterator over a reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct Iter<'a, A: 'a> {\n    inner: Item<&'a A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for Iter<'a, A> {\n    type Item = &'a A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for Iter<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for Iter<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for Iter<'_, A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for Iter<'_, A> {}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Clone for Iter<'_, A> {\n    #[inline]\n    fn clone(&self) -> Self {\n        Iter { inner: self.inner.clone() }\n    }\n}\n\n/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter_mut`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct IterMut<'a, A: 'a> {\n    inner: Item<&'a mut A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for IterMut<'a, A> {\n    type Item = &'a mut A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a mut A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for IterMut<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a mut A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IterMut<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IterMut<'_, A> {}\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IterMut<'_, A> {}\n\n/// An iterator over the value in [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::into_iter`] function.\n#[derive(Clone, Debug)]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub struct IntoIter<A> {\n    inner: Item<A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Iterator for IntoIter<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> DoubleEndedIterator for IntoIter<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IntoIter<A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IntoIter<A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IntoIter<A> {}\n\n/////////////////////////////////////////////////////////////////////////////\n// FromIterator\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {\n    /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],\n    /// no further elements are taken, and the [`None`][Option::None] is\n    /// returned. Should no [`None`][Option::None] occur, a container of type\n    /// `V` containing the values of each [`Option`] is returned.\n    ///\n    /// # Examples\n    ///\n    /// Here is an example which increments every integer in a vector.\n    /// We use the checked variant of `add` that returns `None` when the\n    /// calculation would result in an overflow.\n    ///\n    /// ```\n    /// let items = vec![0_u16, 1, 2];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_add(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, Some(vec![1, 2, 3]));\n    /// ```\n    ///\n    /// As you can see, this will return the expected, valid items.\n    ///\n    /// Here is another example that tries to subtract one from another list\n    /// of integers, this time checking for underflow:\n    ///\n    /// ```\n    /// let items = vec![2_u16, 1, 0];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_sub(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// ```\n    ///\n    /// Since the last element is zero, it would underflow. Thus, the resulting\n    /// value is `None`.\n    ///\n    /// Here is a variation on the previous example, showing that no\n    /// further elements are taken from `iter` after the first `None`.\n    ///\n    /// ```\n    /// let items = vec![3_u16, 2, 1, 10];\n    ///\n    /// let mut shared = 0;\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| { shared += x; x.checked_sub(2) })\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// assert_eq!(shared, 6);\n    /// ```\n    ///\n    /// Since the third element caused an underflow, no further elements were taken,\n    /// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.\n    #[inline]\n    fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {\n        // FIXME(#11084): This could be replaced with Iterator::scan when this\n        // performance bug is closed.\n\n        iter::try_process(iter.into_iter(), |i| i.collect())\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::Try for Option<T> {\n    type Output = T;\n    type Residual = Option<convert::Infallible>;\n\n    #[inline]\n    fn from_output(output: Self::Output) -> Self {\n        Some(output)\n    }\n\n    #[inline]\n    fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n        match self {\n            Some(v) => ControlFlow::Continue(v),\n            None => ControlFlow::Break(None),\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::FromResidual for Option<T> {\n    #[inline]\n    fn from_residual(residual: Option<convert::Infallible>) -> Self {\n        match residual {\n            None => None,\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_yeet\", issue = \"96374\")]\nimpl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {\n    #[inline]\n    fn from_residual(ops::Yeet(()): ops::Yeet<()>) -> Self {\n        None\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_residual\", issue = \"91285\")]\nimpl<T> ops::Residual<T> for Option<convert::Infallible> {\n    type TryType = Option<T>;\n}\n\nimpl<T> Option<Option<T>> {\n    /// Converts from `Option<Option<T>>` to `Option<T>`.\n    ///\n    /// # Examples\n    ///\n    /// Basic usage:\n    ///\n    /// ```\n    /// let x: Option<Option<u32>> = Some(Some(6));\n    /// assert_eq!(Some(6), x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = Some(None);\n    /// assert_eq!(None, x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = None;\n    /// assert_eq!(None, x.flatten());\n    /// ```\n    ///\n    /// Flattening only removes one level of nesting at a time:\n    ///\n    /// ```\n    /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));\n    /// assert_eq!(Some(Some(6)), x.flatten());\n    /// assert_eq!(Some(6), x.flatten().flatten());\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_flattening\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn flatten(self) -> Option<T> {\n        match self {\n            Some(inner) => inner,\n            None => None,\n        }\n    }\n}\n","uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","version":0}
17:00:16 INFO unnamed src/language_server_protocol.rs:1888 text_document_code_lens; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:command","params":["setlocal omnifunc=LanguageClient#complete"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","LanguageClient_projectRoot","/home/dick/LanguageClient-neovim"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientTextDocumentDidOpenPost"]}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"//! Optional values.\n//!\n//! Type [`Option`] represents an optional value: every [`Option`]\n//! is either [`Some`] and contains a value, or [`None`], and\n//! does not. [`Option`] types are very common in Rust code, as\n//! they have a number of uses:\n//!\n//! * Initial values\n//! * Return values for functions that are not defined\n//!   over their entire input range (partial functions)\n//! * Return value for otherwise reporting simple errors, where [`None`] is\n//!   returned on error\n//! * Optional struct fields\n//! * Struct fields that can be loaned or \"taken\"\n//! * Optional function arguments\n//! * Nullable pointers\n//! * Swapping things out of difficult situations\n//!\n//! [`Option`]s are commonly paired with pattern matching to query the presence\n//! of a value and take action, always accounting for the [`None`] case.\n//!\n//! ```\n//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {\n//!     if denominator == 0.0 {\n//!         None\n//!     } else {\n//!         Some(numerator / denominator)\n//!     }\n//! }\n//!\n//! // The return value of the function is an option\n//! let result = divide(2.0, 3.0);\n//!\n//! // Pattern match to retrieve the value\n//! match result {\n//!     // The division was valid\n//!     Some(x) => println!(\"Result: {x}\"),\n//!     // The division was invalid\n//!     None    => println!(\"Cannot divide by 0\"),\n//! }\n//! ```\n//!\n//\n// FIXME: Show how `Option` is used in practice, with lots of methods\n//\n//! # Options and pointers (\"nullable\" pointers)\n//!\n//! Rust's pointer types must always point to a valid location; there are\n//! no \"null\" references. Instead, Rust has *optional* pointers, like\n//! the optional owned box, <code>[Option]<[Box\\<T>]></code>.\n//!\n//! [Box\\<T>]: ../../std/boxed/struct.Box.html\n//!\n//! The following example uses [`Option`] to create an optional box of\n//! [`i32`]. Notice that in order to use the inner [`i32`] value, the\n//! `check_optional` function first needs to use pattern matching to\n//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or\n//! not ([`None`]).\n//!\n//! ```\n//! let optional = None;\n//! check_optional(optional);\n//!\n//! let optional = Some(Box::new(9000));\n//! check_optional(optional);\n//!\n//! fn check_optional(optional: Option<Box<i32>>) {\n//!     match optional {\n//!         Some(p) => println!(\"has value {p}\"),\n//!         None => println!(\"has no value\"),\n//!     }\n//! }\n//! ```\n//!\n//! # Representation\n//!\n//! Rust guarantees to optimize the following types `T` such that\n//! [`Option<T>`] has the same size as `T`:\n//!\n//! * [`Box<U>`]\n//! * `&U`\n//! * `&mut U`\n//! * `fn`, `extern \"C\" fn`[^extern_fn]\n//! * [`num::NonZero*`]\n//! * [`ptr::NonNull<U>`]\n//! * `#[repr(transparent)]` struct around one of the types in this list.\n//!\n//! [^extern_fn]: this remains true for any other ABI: `extern \"abi\" fn` (_e.g._, `extern \"system\" fn`)\n//!\n//! [`Box<U>`]: ../../std/boxed/struct.Box.html\n//! [`num::NonZero*`]: crate::num\n//! [`ptr::NonNull<U>`]: crate::ptr::NonNull\n//!\n//! This is called the \"null pointer optimization\" or NPO.\n//!\n//! It is further guaranteed that, for the cases above, one can\n//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and\n//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`\n//! is undefined behaviour).\n//!\n//! # Method overview\n//!\n//! In addition to working with pattern matching, [`Option`] provides a wide\n//! variety of different methods.\n//!\n//! ## Querying the variant\n//!\n//! The [`is_some`] and [`is_none`] methods return [`true`] if the [`Option`]\n//! is [`Some`] or [`None`], respectively.\n//!\n//! [`is_none`]: Option::is_none\n//! [`is_some`]: Option::is_some\n//!\n//! ## Adapters for working with references\n//!\n//! * [`as_ref`] converts from <code>[&][][Option]\\<T></code> to <code>[Option]<[&]T></code>\n//! * [`as_mut`] converts from <code>[&mut] [Option]\\<T></code> to <code>[Option]<[&mut] T></code>\n//! * [`as_deref`] converts from <code>[&][][Option]\\<T></code> to\n//!   <code>[Option]<[&]T::[Target]></code>\n//! * [`as_deref_mut`] converts from <code>[&mut] [Option]\\<T></code> to\n//!   <code>[Option]<[&mut] T::[Target]></code>\n//! * [`as_pin_ref`] converts from <code>[Pin]<[&][][Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&]T>></code>\n//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&mut] T>></code>\n//!\n//! [&]: reference \"shared reference\"\n//! [&mut]: reference \"mutable reference\"\n//! [Target]: Deref::Target \"ops::Deref::Target\"\n//! [`as_deref`]: Option::as_deref\n//! [`as_deref_mut`]: Option::as_deref_mut\n//! [`as_mut`]: Option::as_mut\n//! [`as_pin_mut`]: Option::as_pin_mut\n//! [`as_pin_ref`]: Option::as_pin_ref\n//! [`as_ref`]: Option::as_ref\n//!\n//! ## Extracting the contained value\n//!\n//! These methods extract the contained value in an [`Option<T>`] when it\n//! is the [`Some`] variant. If the [`Option`] is [`None`]:\n//!\n//! * [`expect`] panics with a provided custom message\n//! * [`unwrap`] panics with a generic message\n//! * [`unwrap_or`] returns the provided default value\n//! * [`unwrap_or_default`] returns the default value of the type `T`\n//!   (which must implement the [`Default`] trait)\n//! * [`unwrap_or_else`] returns the result of evaluating the provided\n//!   function\n//!\n//! [`expect`]: Option::expect\n//! [`unwrap`]: Option::unwrap\n//! [`unwrap_or`]: Option::unwrap_or\n//! [`unwrap_or_default`]: Option::unwrap_or_default\n//! [`unwrap_or_else`]: Option::unwrap_or_else\n//!\n//! ## Transforming contained values\n//!\n//! These methods transform [`Option`] to [`Result`]:\n//!\n//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   [`Err(err)`] using the provided default `err` value\n//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   a value of [`Err`] using the provided function\n//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a\n//!   [`Result`] of an [`Option`]\n//!\n//! [`Err(err)`]: Err\n//! [`Ok(v)`]: Ok\n//! [`Some(v)`]: Some\n//! [`ok_or`]: Option::ok_or\n//! [`ok_or_else`]: Option::ok_or_else\n//! [`transpose`]: Option::transpose\n//!\n//! These methods transform the [`Some`] variant:\n//!\n//! * [`filter`] calls the provided predicate function on the contained\n//!   value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]\n//!   if the function returns `true`; otherwise, returns [`None`]\n//! * [`flatten`] removes one level of nesting from an\n//!   [`Option<Option<T>>`]\n//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the\n//!   provided function to the contained value of [`Some`] and leaving\n//!   [`None`] values unchanged\n//!\n//! [`Some(t)`]: Some\n//! [`filter`]: Option::filter\n//! [`flatten`]: Option::flatten\n//! [`map`]: Option::map\n//!\n//! These methods transform [`Option<T>`] to a value of a possibly\n//! different type `U`:\n//!\n//! * [`map_or`] applies the provided function to the contained value of\n//!   [`Some`], or returns the provided default value if the [`Option`] is\n//!   [`None`]\n//! * [`map_or_else`] applies the provided function to the contained value\n//!   of [`Some`], or returns the result of evaluating the provided\n//!   fallback function if the [`Option`] is [`None`]\n//!\n//! [`map_or`]: Option::map_or\n//! [`map_or_else`]: Option::map_or_else\n//!\n//! These methods combine the [`Some`] variants of two [`Option`] values:\n//!\n//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the\n//!   provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//! * [`zip_with`] calls the provided function `f` and returns\n//!   [`Some(f(s, o))`] if `self` is [`Some(s)`] and the provided\n//!   [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//!\n//! [`Some(f(s, o))`]: Some\n//! [`Some(o)`]: Some\n//! [`Some(s)`]: Some\n//! [`Some((s, o))`]: Some\n//! [`zip`]: Option::zip\n//! [`zip_with`]: Option::zip_with\n//!\n//! ## Boolean operators\n//!\n//! These methods treat the [`Option`] as a boolean value, where [`Some`]\n//! acts like [`true`] and [`None`] acts like [`false`]. There are two\n//! categories of these methods: ones that take an [`Option`] as input, and\n//! ones that take a function as input (to be lazily evaluated).\n//!\n//! The [`and`], [`or`], and [`xor`] methods take another [`Option`] as\n//! input, and produce an [`Option`] as output. Only the [`and`] method can\n//! produce an [`Option<U>`] value having a different inner type `U` than\n//! [`Option<T>`].\n//!\n//! | method  | self      | input     | output    |\n//! |---------|-----------|-----------|-----------|\n//! | [`and`] | `None`    | (ignored) | `None`    |\n//! | [`and`] | `Some(x)` | `None`    | `None`    |\n//! | [`and`] | `Some(x)` | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `None`    | `None`    | `None`    |\n//! | [`or`]  | `None`    | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `Some(x)` | (ignored) | `Some(x)` |\n//! | [`xor`] | `None`    | `None`    | `None`    |\n//! | [`xor`] | `None`    | `Some(y)` | `Some(y)` |\n//! | [`xor`] | `Some(x)` | `None`    | `Some(x)` |\n//! | [`xor`] | `Some(x)` | `Some(y)` | `None`    |\n//!\n//! [`and`]: Option::and\n//! [`or`]: Option::or\n//! [`xor`]: Option::xor\n//!\n//! The [`and_then`] and [`or_else`] methods take a function as input, and\n//! only evaluate the function when they need to produce a new value. Only\n//! the [`and_then`] method can produce an [`Option<U>`] value having a\n//! different inner type `U` than [`Option<T>`].\n//!\n//! | method       | self      | function input | function result | output    |\n//! |--------------|-----------|----------------|-----------------|-----------|\n//! | [`and_then`] | `None`    | (not provided) | (not evaluated) | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `None`          | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `None`    | (not provided) | `None`          | `None`    |\n//! | [`or_else`]  | `None`    | (not provided) | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `Some(x)` | (not provided) | (not evaluated) | `Some(x)` |\n//!\n//! [`and_then`]: Option::and_then\n//! [`or_else`]: Option::or_else\n//!\n//! This is an example of using methods like [`and_then`] and [`or`] in a\n//! pipeline of method calls. Early stages of the pipeline pass failure\n//! values ([`None`]) through unchanged, and continue processing on\n//! success values ([`Some`]). Toward the end, [`or`] substitutes an error\n//! message if it receives [`None`].\n//!\n//! ```\n//! # use std::collections::BTreeMap;\n//! let mut bt = BTreeMap::new();\n//! bt.insert(20u8, \"foo\");\n//! bt.insert(42u8, \"bar\");\n//! let res = [0u8, 1, 11, 200, 22]\n//!     .into_iter()\n//!     .map(|x| {\n//!         // `checked_sub()` returns `None` on error\n//!         x.checked_sub(1)\n//!             // same with `checked_mul()`\n//!             .and_then(|x| x.checked_mul(2))\n//!             // `BTreeMap::get` returns `None` on error\n//!             .and_then(|x| bt.get(&x))\n//!             // Substitute an error message if we have `None` so far\n//!             .or(Some(&\"error!\"))\n//!             .copied()\n//!             // Won't panic because we unconditionally used `Some` above\n//!             .unwrap()\n//!     })\n//!     .collect::<Vec<_>>();\n//! assert_eq!(res, [\"error!\", \"error!\", \"foo\", \"error!\", \"bar\"]);\n//! ```\n//!\n//! ## Comparison operators\n//!\n//! If `T` implements [`PartialOrd`] then [`Option<T>`] will derive its\n//! [`PartialOrd`] implementation.  With this order, [`None`] compares as\n//! less than any [`Some`], and two [`Some`] compare the same way as their\n//! contained values would in `T`.  If `T` also implements\n//! [`Ord`], then so does [`Option<T>`].\n//!\n//! ```\n//! assert!(None < Some(0));\n//! assert!(Some(0) < Some(1));\n//! ```\n//!\n//! ## Iterating over `Option`\n//!\n//! An [`Option`] can be iterated over. This can be helpful if you need an\n//! iterator that is conditionally empty. The iterator will either produce\n//! a single value (when the [`Option`] is [`Some`]), or produce no values\n//! (when the [`Option`] is [`None`]). For example, [`into_iter`] acts like\n//! [`once(v)`] if the [`Option`] is [`Some(v)`], and like [`empty()`] if\n//! the [`Option`] is [`None`].\n//!\n//! [`Some(v)`]: Some\n//! [`empty()`]: crate::iter::empty\n//! [`once(v)`]: crate::iter::once\n//!\n//! Iterators over [`Option<T>`] come in three types:\n//!\n//! * [`into_iter`] consumes the [`Option`] and produces the contained\n//!   value\n//! * [`iter`] produces an immutable reference of type `&T` to the\n//!   contained value\n//! * [`iter_mut`] produces a mutable reference of type `&mut T` to the\n//!   contained value\n//!\n//! [`into_iter`]: Option::into_iter\n//! [`iter`]: Option::iter\n//! [`iter_mut`]: Option::iter_mut\n//!\n//! An iterator over [`Option`] can be useful when chaining iterators, for\n//! example, to conditionally insert items. (It's not always necessary to\n//! explicitly call an iterator constructor: many [`Iterator`] methods that\n//! accept other iterators will also accept iterable types that implement\n//! [`IntoIterator`], which includes [`Option`].)\n//!\n//! ```\n//! let yep = Some(42);\n//! let nope = None;\n//! // chain() already calls into_iter(), so we don't have to do so\n//! let nums: Vec<i32> = (0..4).chain(yep).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 42, 4, 5, 6, 7]);\n//! let nums: Vec<i32> = (0..4).chain(nope).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 4, 5, 6, 7]);\n//! ```\n//!\n//! One reason to chain iterators in this way is that a function returning\n//! `impl Iterator` must have all possible return values be of the same\n//! concrete type. Chaining an iterated [`Option`] can help with that.\n//!\n//! ```\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types matching\n//!     match do_insert {\n//!         true => return (0..4).chain(Some(42)).chain(4..8),\n//!         false => return (0..4).chain(None).chain(4..8),\n//!     }\n//! }\n//! println!(\"{:?}\", make_iter(true).collect::<Vec<_>>());\n//! println!(\"{:?}\", make_iter(false).collect::<Vec<_>>());\n//! ```\n//!\n//! If we try to do the same thing, but using [`once()`] and [`empty()`],\n//! we can't return `impl Iterator` anymore because the concrete types of\n//! the return values differ.\n//!\n//! [`empty()`]: crate::iter::empty\n//! [`once()`]: crate::iter::once\n//!\n//! ```compile_fail,E0308\n//! # use std::iter::{empty, once};\n//! // This won't compile because all possible returns from the function\n//! // must have the same concrete type.\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types not matching\n//!     match do_insert {\n//!         true => return (0..4).chain(once(42)).chain(4..8),\n//!         false => return (0..4).chain(empty()).chain(4..8),\n//!     }\n//! }\n//! ```\n//!\n//! ## Collecting into `Option`\n//!\n//! [`Option`] implements the [`FromIterator`][impl-FromIterator] trait,\n//! which allows an iterator over [`Option`] values to be collected into an\n//! [`Option`] of a collection of each contained value of the original\n//! [`Option`] values, or [`None`] if any of the elements was [`None`].\n//!\n//! [impl-FromIterator]: Option#impl-FromIterator%3COption%3CA%3E%3E\n//!\n//! ```\n//! let v = [Some(2), Some(4), None, Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, None);\n//! let v = [Some(2), Some(4), Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, Some(vec![2, 4, 8]));\n//! ```\n//!\n//! [`Option`] also implements the [`Product`][impl-Product] and\n//! [`Sum`][impl-Sum] traits, allowing an iterator over [`Option`] values\n//! to provide the [`product`][Iterator::product] and\n//! [`sum`][Iterator::sum] methods.\n//!\n//! [impl-Product]: Option#impl-Product%3COption%3CU%3E%3E\n//! [impl-Sum]: Option#impl-Sum%3COption%3CU%3E%3E\n//!\n//! ```\n//! let v = [None, Some(1), Some(2), Some(3)];\n//! let res: Option<i32> = v.into_iter().sum();\n//! assert_eq!(res, None);\n//! let v = [Some(1), Some(2), Some(21)];\n//! let res: Option<i32> = v.into_iter().product();\n//! assert_eq!(res, Some(42));\n//! ```\n//!\n//! ## Modifying an [`Option`] in-place\n//!\n//! These methods return a mutable reference to the contained value of an\n//! [`Option<T>`]:\n//!\n//! * [`insert`] inserts a value, dropping any old contents\n//! * [`get_or_insert`] gets the current value, inserting a provided\n//!   default value if it is [`None`]\n//! * [`get_or_insert_default`] gets the current value, inserting the\n//!   default value of type `T` (which must implement [`Default`]) if it is\n//!   [`None`]\n//! * [`get_or_insert_with`] gets the current value, inserting a default\n//!   computed by the provided function if it is [`None`]\n//!\n//! [`get_or_insert`]: Option::get_or_insert\n//! [`get_or_insert_default`]: Option::get_or_insert_default\n//! [`get_or_insert_with`]: Option::get_or_insert_with\n//! [`insert`]: Option::insert\n//!\n//! These methods transfer ownership of the contained value of an\n//! [`Option`]:\n//!\n//! * [`take`] takes ownership of the contained value of an [`Option`], if\n//!   any, replacing the [`Option`] with [`None`]\n//! * [`replace`] takes ownership of the contained value of an [`Option`],\n//!   if any, replacing the [`Option`] with a [`Some`] containing the\n//!   provided value\n//!\n//! [`replace`]: Option::replace\n//! [`take`]: Option::take\n//!\n//! # Examples\n//!\n//! Basic pattern matching on [`Option`]:\n//!\n//! ```\n//! let msg = Some(\"howdy\");\n//!\n//! // Take a reference to the contained string\n//! if let Some(m) = &msg {\n//!     println!(\"{}\", *m);\n//! }\n//!\n//! // Remove the contained string, destroying the Option\n//! let unwrapped_msg = msg.unwrap_or(\"default message\");\n//! ```\n//!\n//! Initialize a result to [`None`] before a loop:\n//!\n//! ```\n//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }\n//!\n//! // A list of data to search through.\n//! let all_the_big_things = [\n//!     Kingdom::Plant(250, \"redwood\"),\n//!     Kingdom::Plant(230, \"noble fir\"),\n//!     Kingdom::Plant(229, \"sugar pine\"),\n//!     Kingdom::Animal(25, \"blue whale\"),\n//!     Kingdom::Animal(19, \"fin whale\"),\n//!     Kingdom::Animal(15, \"north pacific right whale\"),\n//! ];\n//!\n//! // We're going to search for the name of the biggest animal,\n//! // but to start with we've just got `None`.\n//! let mut name_of_biggest_animal = None;\n//! let mut size_of_biggest_animal = 0;\n//! for big_thing in &all_the_big_things {\n//!     match *big_thing {\n//!         Kingdom::Animal(size, name) if size > size_of_biggest_animal => {\n//!             // Now we've found the name of some big animal\n//!             size_of_biggest_animal = size;\n//!             name_of_biggest_animal = Some(name);\n//!         }\n//!         Kingdom::Animal(..) | Kingdom::Plant(..) => ()\n//!     }\n//! }\n//!\n//! match name_of_biggest_animal {\n//!     Some(name) => println!(\"the biggest animal is {name}\"),\n//!     None => println!(\"there are no animals :(\"),\n//! }\n//! ```\n\n#![stable(feature = \"rust1\", since = \"1.0.0\")]\n\nuse crate::iter::{self, FromIterator, FusedIterator, TrustedLen};\nuse crate::marker::Destruct;\nuse crate::panicking::{panic, panic_str};\nuse crate::pin::Pin;\nuse crate::{\n    convert, hint, mem,\n    ops::{self, ControlFlow, Deref, DerefMut},\n};\n\n/// The `Option` type. See [the module level documentation](self) for more.\n#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]\n#[rustc_diagnostic_item = \"Option\"]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub enum Option<T> {\n    /// No value.\n    #[lang = \"None\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    None,\n    /// Some value of type `T`.\n    #[lang = \"Some\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    Some(#[stable(feature = \"rust1\", since = \"1.0.0\")] T),\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Type implementation\n/////////////////////////////////////////////////////////////////////////////\n\nimpl<T> Option<T> {\n    /////////////////////////////////////////////////////////////////////////\n    // Querying the contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns `true` if the option is a [`Some`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some(), true);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some(), false);\n    /// ```\n    #[must_use = \"if you intended to assert that this has a value, consider `.unwrap()` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_some(&self) -> bool {\n        matches!(*self, Some(_))\n    }\n\n    /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(is_some_with)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), true);\n    ///\n    /// let x: Option<u32> = Some(0);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"is_some_with\", issue = \"93050\")]\n    pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool {\n        matches!(self, Some(x) if f(x))\n    }\n\n    /// Returns `true` if the option is a [`None`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_none(), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_none(), true);\n    /// ```\n    #[must_use = \"if you intended to assert that this doesn't have a value, consider \\\n                  `.and_then(|_| panic!(\\\"`Option` had a value when expected `None`\\\"))` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_none(&self) -> bool {\n        !self.is_some()\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Adapter for working with references\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `as_ref` to first take an `Option` to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let text: Option<String> = Some(\"Hello, world!\".to_string());\n    /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,\n    /// // then consume *that* with `map`, leaving `text` on the stack.\n    /// let text_length: Option<usize> = text.as_ref().map(|s| s.len());\n    /// println!(\"still can print text: {text:?}\");\n    /// ```\n    #[inline]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn as_ref(&self) -> Option<&T> {\n        match *self {\n            Some(ref x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// match x.as_mut() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn as_mut(&mut self) -> Option<&mut T> {\n        match *self {\n            Some(ref mut x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&]Option\\<T>></code> to <code>Option<[Pin]<[&]T>></code>.\n    ///\n    /// [&]: reference \"shared reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {\n        match Pin::get_ref(self).as_ref() {\n            // SAFETY: `x` is guaranteed to be pinned because it comes from `self`\n            // which is pinned.\n            Some(x) => unsafe { Some(Pin::new_unchecked(x)) },\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&mut] Option\\<T>></code> to <code>Option<[Pin]<[&mut] T>></code>.\n    ///\n    /// [&mut]: reference \"mutable reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {\n        // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.\n        // `x` is guaranteed to be pinned because it comes from `self` which is pinned.\n        unsafe {\n            match Pin::get_unchecked_mut(self).as_mut() {\n                Some(x) => Some(Pin::new_unchecked(x)),\n                None => None,\n            }\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Getting to contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the value is a [`None`] with a custom panic message provided by\n    /// `msg`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"value\");\n    /// assert_eq!(x.expect(\"fruits are healthy\"), \"value\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// x.expect(\"fruits are healthy\"); // panics with `fruits are healthy`\n    /// ```\n    ///\n    /// # Recommended Message Style\n    ///\n    /// We recommend that `expect` messages are used to describe the reason you\n    /// _expect_ the `Option` should be `Some`.\n    ///\n    /// ```should_panic\n    /// # let slice: &[u8] = &[];\n    /// let item = slice.get(0)\n    ///     .expect(\"slice should not be empty\");\n    /// ```\n    ///\n    /// **Hint**: If you're having trouble remembering how to phrase expect\n    /// error messages remember to focus on the word \"should\" as in \"env\n    /// variable should be set by blah\" or \"the given binary should be available\n    /// and executable by the current user\".\n    ///\n    /// For more detail on expect message styles and the reasoning behind our\n    /// recommendation please refer to the section on [\"Common Message\n    /// Styles\"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs.\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn expect(self, msg: &str) -> T {\n        match self {\n            Some(val) => val,\n            None => expect_failed(msg),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// Because this function may panic, its use is generally discouraged.\n    /// Instead, prefer to use pattern matching and handle the [`None`]\n    /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or\n    /// [`unwrap_or_default`].\n    ///\n    /// [`unwrap_or`]: Option::unwrap_or\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    /// [`unwrap_or_default`]: Option::unwrap_or_default\n    ///\n    /// # Panics\n    ///\n    /// Panics if the self value equals [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(x.unwrap(), \"air\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.unwrap(), \"air\"); // fails\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn unwrap(self) -> T {\n        match self {\n            Some(val) => val,\n            None => panic(\"called `Option::unwrap()` on a `None` value\"),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a provided default.\n    ///\n    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`unwrap_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// assert_eq!(Some(\"car\").unwrap_or(\"bike\"), \"car\");\n    /// assert_eq!(None.unwrap_or(\"bike\"), \"bike\");\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or(self, default: T) -> T\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => default,\n        }\n    }\n\n    /// Returns the contained [`Some`] value or computes it from a closure.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 10;\n    /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);\n    /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_else<F>(self, f: F) -> T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => f(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a default.\n    ///\n    /// Consumes the `self` argument then, if [`Some`], returns the contained\n    /// value, otherwise if [`None`], returns the [default value] for that\n    /// type.\n    ///\n    /// # Examples\n    ///\n    /// Converts a string to an integer, turning poorly-formed strings\n    /// into 0 (the default value for integers). [`parse`] converts\n    /// a string to any other type that implements [`FromStr`], returning\n    /// [`None`] on error.\n    ///\n    /// ```\n    /// let good_year_from_input = \"1909\";\n    /// let bad_year_from_input = \"190blarg\";\n    /// let good_year = good_year_from_input.parse().ok().unwrap_or_default();\n    /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();\n    ///\n    /// assert_eq!(1909, good_year);\n    /// assert_eq!(0, bad_year);\n    /// ```\n    ///\n    /// [default value]: Default::default\n    /// [`parse`]: str::parse\n    /// [`FromStr`]: crate::str::FromStr\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_default(self) -> T\n    where\n        T: ~const Default,\n    {\n        match self {\n            Some(x) => x,\n            None => Default::default(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value,\n    /// without checking that the value is not [`None`].\n    ///\n    /// # Safety\n    ///\n    /// Calling this method on [`None`] is *[undefined behavior]*.\n    ///\n    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\");\n    /// ```\n    ///\n    /// ```no_run\n    /// let x: Option<&str> = None;\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\"); // Undefined behavior!\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"option_result_unwrap_unchecked\", since = \"1.58.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const unsafe fn unwrap_unchecked(self) -> T {\n        debug_assert!(self.is_some());\n        match self {\n            Some(val) => val,\n            // SAFETY: the safety contract must be upheld by the caller.\n            None => unsafe { hint::unreachable_unchecked() },\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Transforming contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming\n    /// the original:\n    ///\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    /// ```\n    /// let maybe_some_string = Some(String::from(\"Hello, World!\"));\n    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`\n    /// let maybe_some_len = maybe_some_string.map(|s| s.len());\n    ///\n    /// assert_eq!(maybe_some_len, Some(13));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(f(x)),\n            None => None,\n        }\n    }\n\n    /// Calls the provided closure with a reference to the contained value (if [`Some`]).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(result_option_inspect)]\n    ///\n    /// let v = vec![1, 2, 3, 4, 5];\n    ///\n    /// // prints \"got: 4\"\n    /// let x: Option<&usize> = v.get(3).inspect(|x| println!(\"got: {x}\"));\n    ///\n    /// // prints nothing\n    /// let x: Option<&usize> = v.get(5).inspect(|x| println!(\"got: {x}\"));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"result_option_inspect\", issue = \"91345\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn inspect<F>(self, f: F) -> Self\n    where\n        F: ~const FnOnce(&T),\n        F: ~const Destruct,\n    {\n        if let Some(ref x) = self {\n            f(x);\n        }\n\n        self\n    }\n\n    /// Returns the provided default result (if none),\n    /// or applies a function to the contained value (if any).\n    ///\n    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`map_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`map_or_else`]: Option::map_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or(42, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or(42, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or<U, F>(self, default: U, f: F) -> U\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default,\n        }\n    }\n\n    /// Computes a default function result (if none), or\n    /// applies a different function to the contained value (if any).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 21;\n    ///\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U\n    where\n        D: ~const FnOnce() -> U,\n        D: ~const Destruct,\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default(),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err)`].\n    ///\n    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`ok_or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err)`]: Err\n    /// [`Some(v)`]: Some\n    /// [`ok_or_else`]: Option::ok_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or(0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or(0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or<E>(self, err: E) -> Result<T, E>\n    where\n        E: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err())`].\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err())`]: Err\n    /// [`Some(v)`]: Some\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or_else(|| 0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or_else(|| 0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>\n    where\n        F: ~const FnOnce() -> E,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err()),\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.\n    ///\n    /// Leaves the original Option in-place, creating a new one with a reference\n    /// to the original one, additionally coercing the contents via [`Deref`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref(), Some(\"hey\"));\n    ///\n    /// let x: Option<String> = None;\n    /// assert_eq!(x.as_deref(), None);\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref(&self) -> Option<&T::Target>\n    where\n        T: ~const Deref,\n    {\n        match self.as_ref() {\n            Some(t) => Some(t.deref()),\n            None => None,\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.\n    ///\n    /// Leaves the original `Option` in-place, creating a new one containing a mutable reference to\n    /// the inner type's [`Deref::Target`] type.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref_mut().map(|x| {\n    ///     x.make_ascii_uppercase();\n    ///     x\n    /// }), Some(\"HEY\".to_owned().as_mut_str()));\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>\n    where\n        T: ~const DerefMut,\n    {\n        match self.as_mut() {\n            Some(t) => Some(t.deref_mut()),\n            None => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Iterator constructors\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns an iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(4);\n    /// assert_eq!(x.iter().next(), Some(&4));\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.iter().next(), None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn iter(&self) -> Iter<'_, T> {\n        Iter { inner: Item { opt: self.as_ref() } }\n    }\n\n    /// Returns a mutable iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(4);\n    /// match x.iter_mut().next() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// assert_eq!(x.iter_mut().next(), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub fn iter_mut(&mut self) -> IterMut<'_, T> {\n        IterMut { inner: Item { opt: self.as_mut() } }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Boolean operations on the values, eager and lazy\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns [`None`] if the option is [`None`], otherwise returns `optb`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x = Some(2);\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), Some(\"foo\"));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and<U>(self, optb: Option<U>) -> Option<U>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(_) => optb,\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `f` with the\n    /// wrapped value and returns the result.\n    ///\n    /// Some languages call this operation flatmap.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn sq_then_to_string(x: u32) -> Option<String> {\n    ///     x.checked_mul(x).map(|sq| sq.to_string())\n    /// }\n    ///\n    /// assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string()));\n    /// assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed!\n    /// assert_eq!(None.and_then(sq_then_to_string), None);\n    /// ```\n    ///\n    /// Often used to chain fallible operations that may return [`None`].\n    ///\n    /// ```\n    /// let arr_2d = [[\"A0\", \"A1\"], [\"B0\", \"B1\"]];\n    ///\n    /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1));\n    /// assert_eq!(item_0_1, Some(&\"A1\"));\n    ///\n    /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));\n    /// assert_eq!(item_2_0, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and_then<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> Option<U>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => f(x),\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `predicate`\n    /// with the wrapped value and returns:\n    ///\n    /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped\n    ///   value), and\n    /// - [`None`] if `predicate` returns `false`.\n    ///\n    /// This function works similar to [`Iterator::filter()`]. You can imagine\n    /// the `Option<T>` being an iterator over one or zero elements. `filter()`\n    /// lets you decide which elements to keep.\n    ///\n    /// # Examples\n    ///\n    /// ```rust\n    /// fn is_even(n: &i32) -> bool {\n    ///     n % 2 == 0\n    /// }\n    ///\n    /// assert_eq!(None.filter(is_even), None);\n    /// assert_eq!(Some(3).filter(is_even), None);\n    /// assert_eq!(Some(4).filter(is_even), Some(4));\n    /// ```\n    ///\n    /// [`Some(t)`]: Some\n    #[inline]\n    #[stable(feature = \"option_filter\", since = \"1.27.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn filter<P>(self, predicate: P) -> Self\n    where\n        T: ~const Destruct,\n        P: ~const FnOnce(&T) -> bool,\n        P: ~const Destruct,\n    {\n        if let Some(x) = self {\n            if predicate(&x) {\n                return Some(x);\n            }\n        }\n        None\n    }\n\n    /// Returns the option if it contains a value, otherwise returns `optb`.\n    ///\n    /// Arguments passed to `or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`or_else`]: Option::or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y = None;\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x = None;\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(100));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = None;\n    /// assert_eq!(x.or(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => optb,\n        }\n    }\n\n    /// Returns the option if it contains a value, otherwise calls `f` and\n    /// returns the result.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn nobody() -> Option<&'static str> { None }\n    /// fn vikings() -> Option<&'static str> { Some(\"vikings\") }\n    ///\n    /// assert_eq!(Some(\"barbarians\").or_else(vikings), Some(\"barbarians\"));\n    /// assert_eq!(None.or_else(vikings), Some(\"vikings\"));\n    /// assert_eq!(None.or_else(nobody), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or_else<F>(self, f: F) -> Option<T>\n    where\n        F: ~const FnOnce() -> Option<T>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => f(),\n        }\n    }\n\n    /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_xor\", since = \"1.37.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn xor(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match (self, optb) {\n            (Some(a), None) => Some(a),\n            (None, Some(b)) => Some(b),\n            _ => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Entry-like operations to insert a value and return a reference\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Inserts `value` into the option, then returns a mutable reference to it.\n    ///\n    /// If the option already contains a value, the old value is dropped.\n    ///\n    /// See also [`Option::get_or_insert`], which doesn't update the value if\n    /// the option already contains [`Some`].\n    ///\n    /// # Example\n    ///\n    /// ```\n    /// let mut opt = None;\n    /// let val = opt.insert(1);\n    /// assert_eq!(*val, 1);\n    /// assert_eq!(opt.unwrap(), 1);\n    /// let val = opt.insert(2);\n    /// assert_eq!(*val, 2);\n    /// *val = 3;\n    /// assert_eq!(opt.unwrap(), 3);\n    /// ```\n    #[must_use = \"if you intended to set a value, consider assignment instead\"]\n    #[inline]\n    #[stable(feature = \"option_insert\", since = \"1.53.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        *self = Some(value);\n\n        // SAFETY: the code above just filled the option\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts `value` into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// See also [`Option::insert`], which updates the value even if\n    /// the option already contains [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert(5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        if let None = *self {\n            *self = Some(value);\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts the default value into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_get_or_insert_default)]\n    ///\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_default();\n    ///     assert_eq!(y, &0);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"option_get_or_insert_default\", issue = \"82901\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_default(&mut self) -> &mut T\n    where\n        T: ~const Default,\n    {\n        const fn default<T: ~const Default>() -> T {\n            T::default()\n        }\n\n        self.get_or_insert_with(default)\n    }\n\n    /// Inserts a value computed from `f` into the option if it is [`None`],\n    /// then returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        if let None = *self {\n            // the compiler isn't smart enough to know that we are not dropping a `T`\n            // here and wants us to ensure `T` can be dropped at compile time.\n            mem::forget(mem::replace(self, Some(f())))\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Misc\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Takes the value out of the option, leaving a [`None`] in its place.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, Some(2));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn take(&mut self) -> Option<T> {\n        // FIXME replace `mem::replace` by `mem::take` when the latter is const ready\n        mem::replace(self, None)\n    }\n\n    /// Replaces the actual value in the option by the value given in parameter,\n    /// returning the old value if present,\n    /// leaving a [`Some`] in its place without deinitializing either one.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let old = x.replace(5);\n    /// assert_eq!(x, Some(5));\n    /// assert_eq!(old, Some(2));\n    ///\n    /// let mut x = None;\n    /// let old = x.replace(3);\n    /// assert_eq!(x, Some(3));\n    /// assert_eq!(old, None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"option_replace\", since = \"1.31.0\")]\n    pub const fn replace(&mut self, value: T) -> Option<T> {\n        mem::replace(self, Some(value))\n    }\n\n    /// Returns `true` if the option is a [`Some`] value containing the given value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_result_contains)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.contains(&2), true);\n    ///\n    /// let x: Option<u32> = Some(3);\n    /// assert_eq!(x.contains(&2), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.contains(&2), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"option_result_contains\", issue = \"62358\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn contains<U>(&self, x: &U) -> bool\n    where\n        U: ~const PartialEq<T>,\n    {\n        match self {\n            Some(y) => x.eq(y),\n            None => false,\n        }\n    }\n\n    /// Zips `self` with another `Option`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(1);\n    /// let y = Some(\"hi\");\n    /// let z = None::<u8>;\n    ///\n    /// assert_eq!(x.zip(y), Some((1, \"hi\")));\n    /// assert_eq!(x.zip(z), None);\n    /// ```\n    #[stable(feature = \"option_zip_option\", since = \"1.46.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some((a, b)),\n            _ => None,\n        }\n    }\n\n    /// Zips `self` and another `Option` with function `f`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_zip)]\n    ///\n    /// #[derive(Debug, PartialEq)]\n    /// struct Point {\n    ///     x: f64,\n    ///     y: f64,\n    /// }\n    ///\n    /// impl Point {\n    ///     fn new(x: f64, y: f64) -> Self {\n    ///         Self { x, y }\n    ///     }\n    /// }\n    ///\n    /// let x = Some(17.5);\n    /// let y = Some(42.7);\n    ///\n    /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 }));\n    /// assert_eq!(x.zip_with(None, Point::new), None);\n    /// ```\n    #[unstable(feature = \"option_zip\", issue = \"70086\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>\n    where\n        F: ~const FnOnce(T, U) -> R,\n        F: ~const Destruct,\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some(f(a, b)),\n            _ => None,\n        }\n    }\n}\n\nimpl<T, U> Option<(T, U)> {\n    /// Unzips an option containing a tuple of two options.\n    ///\n    /// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.\n    /// Otherwise, `(None, None)` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(unzip_option)]\n    ///\n    /// let x = Some((1, \"hi\"));\n    /// let y = None::<(u8, u32)>;\n    ///\n    /// assert_eq!(x.unzip(), (Some(1), Some(\"hi\")));\n    /// assert_eq!(y.unzip(), (None, None));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"unzip_option\", issue = \"87800\", reason = \"recently added\")]\n    pub const fn unzip(self) -> (Option<T>, Option<U>) {\n        match self {\n            Some((a, b)) => (Some(a), Some(b)),\n            None => (None, None),\n        }\n    }\n}\n\nimpl<T> Option<&T> {\n    /// Maps an `Option<&T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        // FIXME: this implementation, which sidesteps using `Option::map` since it's not const\n        // ready yet, should be reverted when possible to avoid code repetition\n        match self {\n            Some(&v) => Some(v),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T> Option<&mut T> {\n    /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        match self {\n            Some(&mut t) => Some(t),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(since = \"1.26.0\", feature = \"option_ref_mut_cloned\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T, E> Option<Result<T, E>> {\n    /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.\n    ///\n    /// [`None`] will be mapped to <code>[Ok]\\([None])</code>.\n    /// <code>[Some]\\([Ok]\\(\\_))</code> and <code>[Some]\\([Err]\\(\\_))</code> will be mapped to\n    /// <code>[Ok]\\([Some]\\(\\_))</code> and <code>[Err]\\(\\_)</code>.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #[derive(Debug, Eq, PartialEq)]\n    /// struct SomeErr;\n    ///\n    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));\n    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));\n    /// assert_eq!(x, y.transpose());\n    /// ```\n    #[inline]\n    #[stable(feature = \"transpose_result\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn transpose(self) -> Result<Option<T>, E> {\n        match self {\n            Some(Ok(x)) => Ok(Some(x)),\n            Some(Err(e)) => Err(e),\n            None => Ok(None),\n        }\n    }\n}\n\n// This is a separate function to reduce the code size of .expect() itself.\n#[cfg_attr(not(feature = \"panic_immediate_abort\"), inline(never))]\n#[cfg_attr(feature = \"panic_immediate_abort\", inline)]\n#[cold]\n#[track_caller]\n#[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\nconst fn expect_failed(msg: &str) -> ! {\n    panic_str(msg)\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Trait implementations\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_clone\", issue = \"91805\")]\nimpl<T> const Clone for Option<T>\nwhere\n    T: ~const Clone + ~const Destruct,\n{\n    #[inline]\n    fn clone(&self) -> Self {\n        match self {\n            Some(x) => Some(x.clone()),\n            None => None,\n        }\n    }\n\n    #[inline]\n    fn clone_from(&mut self, source: &Self) {\n        match (self, source) {\n            (Some(to), Some(from)) => to.clone_from(from),\n            (to, from) => *to = from.clone(),\n        }\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_default_impls\", issue = \"87864\")]\nimpl<T> const Default for Option<T> {\n    /// Returns [`None`][Option::None].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let opt: Option<u32> = Option::default();\n    /// assert!(opt.is_none());\n    /// ```\n    #[inline]\n    fn default() -> Option<T> {\n        None\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<T> IntoIterator for Option<T> {\n    type Item = T;\n    type IntoIter = IntoIter<T>;\n\n    /// Returns a consuming iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"string\");\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert_eq!(v, [\"string\"]);\n    ///\n    /// let x = None;\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert!(v.is_empty());\n    /// ```\n    #[inline]\n    fn into_iter(self) -> IntoIter<T> {\n        IntoIter { inner: Item { opt: self } }\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a Option<T> {\n    type Item = &'a T;\n    type IntoIter = Iter<'a, T>;\n\n    fn into_iter(self) -> Iter<'a, T> {\n        self.iter()\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a mut Option<T> {\n    type Item = &'a mut T;\n    type IntoIter = IterMut<'a, T>;\n\n    fn into_iter(self) -> IterMut<'a, T> {\n        self.iter_mut()\n    }\n}\n\n#[stable(since = \"1.12.0\", feature = \"option_from\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const From<T> for Option<T> {\n    /// Moves `val` into a new [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let o: Option<u8> = Option::from(67);\n    ///\n    /// assert_eq!(Some(67), o);\n    /// ```\n    fn from(val: T) -> Option<T> {\n        Some(val)\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a Option<T>> for Option<&'a T> {\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>[Option]<[String]></code> into an <code>[Option]<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `from` to first take an [`Option`] to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let s: Option<String> = Some(String::from(\"Hello, Rustaceans!\"));\n    /// let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());\n    ///\n    /// println!(\"Can still print s: {s:?}\");\n    ///\n    /// assert_eq!(o, Some(18));\n    /// ```\n    fn from(o: &'a Option<T>) -> Option<&'a T> {\n        o.as_ref()\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut s = Some(String::from(\"Hello\"));\n    /// let o: Option<&mut String> = Option::from(&mut s);\n    ///\n    /// match o {\n    ///     Some(t) => *t = String::from(\"Hello, Rustaceans!\"),\n    ///     None => (),\n    /// }\n    ///\n    /// assert_eq!(s, Some(String::from(\"Hello, Rustaceans!\")));\n    /// ```\n    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {\n        o.as_mut()\n    }\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// The Option Iterators\n/////////////////////////////////////////////////////////////////////////////\n\n#[derive(Clone, Debug)]\nstruct Item<A> {\n    opt: Option<A>,\n}\n\nimpl<A> Iterator for Item<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        match self.opt {\n            Some(_) => (1, Some(1)),\n            None => (0, Some(0)),\n        }\n    }\n}\n\nimpl<A> DoubleEndedIterator for Item<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n}\n\nimpl<A> ExactSizeIterator for Item<A> {}\nimpl<A> FusedIterator for Item<A> {}\nunsafe impl<A> TrustedLen for Item<A> {}\n\n/// An iterator over a reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct Iter<'a, A: 'a> {\n    inner: Item<&'a A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for Iter<'a, A> {\n    type Item = &'a A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for Iter<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for Iter<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for Iter<'_, A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for Iter<'_, A> {}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Clone for Iter<'_, A> {\n    #[inline]\n    fn clone(&self) -> Self {\n        Iter { inner: self.inner.clone() }\n    }\n}\n\n/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter_mut`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct IterMut<'a, A: 'a> {\n    inner: Item<&'a mut A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for IterMut<'a, A> {\n    type Item = &'a mut A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a mut A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for IterMut<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a mut A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IterMut<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IterMut<'_, A> {}\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IterMut<'_, A> {}\n\n/// An iterator over the value in [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::into_iter`] function.\n#[derive(Clone, Debug)]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub struct IntoIter<A> {\n    inner: Item<A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Iterator for IntoIter<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> DoubleEndedIterator for IntoIter<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IntoIter<A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IntoIter<A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IntoIter<A> {}\n\n/////////////////////////////////////////////////////////////////////////////\n// FromIterator\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {\n    /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],\n    /// no further elements are taken, and the [`None`][Option::None] is\n    /// returned. Should no [`None`][Option::None] occur, a container of type\n    /// `V` containing the values of each [`Option`] is returned.\n    ///\n    /// # Examples\n    ///\n    /// Here is an example which increments every integer in a vector.\n    /// We use the checked variant of `add` that returns `None` when the\n    /// calculation would result in an overflow.\n    ///\n    /// ```\n    /// let items = vec![0_u16, 1, 2];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_add(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, Some(vec![1, 2, 3]));\n    /// ```\n    ///\n    /// As you can see, this will return the expected, valid items.\n    ///\n    /// Here is another example that tries to subtract one from another list\n    /// of integers, this time checking for underflow:\n    ///\n    /// ```\n    /// let items = vec![2_u16, 1, 0];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_sub(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// ```\n    ///\n    /// Since the last element is zero, it would underflow. Thus, the resulting\n    /// value is `None`.\n    ///\n    /// Here is a variation on the previous example, showing that no\n    /// further elements are taken from `iter` after the first `None`.\n    ///\n    /// ```\n    /// let items = vec![3_u16, 2, 1, 10];\n    ///\n    /// let mut shared = 0;\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| { shared += x; x.checked_sub(2) })\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// assert_eq!(shared, 6);\n    /// ```\n    ///\n    /// Since the third element caused an underflow, no further elements were taken,\n    /// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.\n    #[inline]\n    fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {\n        // FIXME(#11084): This could be replaced with Iterator::scan when this\n        // performance bug is closed.\n\n        iter::try_process(iter.into_iter(), |i| i.collect())\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::Try for Option<T> {\n    type Output = T;\n    type Residual = Option<convert::Infallible>;\n\n    #[inline]\n    fn from_output(output: Self::Output) -> Self {\n        Some(output)\n    }\n\n    #[inline]\n    fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n        match self {\n            Some(v) => ControlFlow::Continue(v),\n            None => ControlFlow::Break(None),\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::FromResidual for Option<T> {\n    #[inline]\n    fn from_residual(residual: Option<convert::Infallible>) -> Self {\n        match residual {\n            None => None,\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_yeet\", issue = \"96374\")]\nimpl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {\n    #[inline]\n    fn from_residual(ops::Yeet(()): ops::Yeet<()>) -> Self {\n        None\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_residual\", issue = \"91285\")]\nimpl<T> ops::Residual<T> for Option<convert::Infallible> {\n    type TryType = Option<T>;\n}\n\nimpl<T> Option<Option<T>> {\n    /// Converts from `Option<Option<T>>` to `Option<T>`.\n    ///\n    /// # Examples\n    ///\n    /// Basic usage:\n    ///\n    /// ```\n    /// let x: Option<Option<u32>> = Some(Some(6));\n    /// assert_eq!(Some(6), x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = Some(None);\n    /// assert_eq!(None, x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = None;\n    /// assert_eq!(None, x.flatten());\n    /// ```\n    ///\n    /// Flattening only removes one level of nesting at a time:\n    ///\n    /// ```\n    /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));\n    /// assert_eq!(Some(Some(6)), x.flatten());\n    /// assert_eq!(Some(6), x.flatten().flatten());\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_flattening\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn flatten(self) -> Option<T> {\n        match self {\n            Some(inner) => inner,\n            None => None,\n        }\n    }\n}\n","uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","version":0}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}},"id":3}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":3,"result":[{"range":{"start":{"line":537,"character":4},"end":{"line":554,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::is_some","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":537,"character":4},"end":{"line":554,"character":5}},"targetSelectionRange":{"start":{"line":537,"character":4},"end":{"line":554,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some","--nocapture"]}}]}},{"range":{"start":{"line":556,"character":4},"end":{"line":577,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::is_some_and","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":556,"character":4},"end":{"line":577,"character":5}},"targetSelectionRange":{"start":{"line":556,"character":4},"end":{"line":577,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some_and","--nocapture"]}}]}},{"range":{"start":{"line":579,"character":4},"end":{"line":597,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::is_none","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":579,"character":4},"end":{"line":597,"character":5}},"targetSelectionRange":{"start":{"line":579,"character":4},"end":{"line":597,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_none","--nocapture"]}}]}},{"range":{"start":{"line":603,"character":4},"end":{"line":630,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_ref","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":603,"character":4},"end":{"line":630,"character":5}},"targetSelectionRange":{"start":{"line":603,"character":4},"end":{"line":630,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_ref","--nocapture"]}}]}},{"range":{"start":{"line":632,"character":4},"end":{"line":652,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_mut","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":632,"character":4},"end":{"line":652,"character":5}},"targetSelectionRange":{"start":{"line":632,"character":4},"end":{"line":652,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_mut","--nocapture"]}}]}},{"range":{"start":{"line":692,"character":4},"end":{"line":739,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::expect","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":692,"character":4},"end":{"line":739,"character":5}},"targetSelectionRange":{"start":{"line":692,"character":4},"end":{"line":739,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::expect","--nocapture"]}}]}},{"range":{"start":{"line":741,"character":4},"end":{"line":776,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":741,"character":4},"end":{"line":776,"character":5}},"targetSelectionRange":{"start":{"line":741,"character":4},"end":{"line":776,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap","--nocapture"]}}]}},{"range":{"start":{"line":778,"character":4},"end":{"line":803,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":778,"character":4},"end":{"line":803,"character":5}},"targetSelectionRange":{"start":{"line":778,"character":4},"end":{"line":803,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or","--nocapture"]}}]}},{"range":{"start":{"line":805,"character":4},"end":{"line":826,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":805,"character":4},"end":{"line":826,"character":5}},"targetSelectionRange":{"start":{"line":805,"character":4},"end":{"line":826,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_else","--nocapture"]}}]}},{"range":{"start":{"line":828,"character":4},"end":{"line":865,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_or_default","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":828,"character":4},"end":{"line":865,"character":5}},"targetSelectionRange":{"start":{"line":828,"character":4},"end":{"line":865,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_default","--nocapture"]}}]}},{"range":{"start":{"line":867,"character":4},"end":{"line":898,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_unchecked","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":867,"character":4},"end":{"line":898,"character":5}},"targetSelectionRange":{"start":{"line":867,"character":4},"end":{"line":898,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_unchecked","--nocapture"]}}]}},{"range":{"start":{"line":904,"character":4},"end":{"line":931,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::map","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":904,"character":4},"end":{"line":931,"character":5}},"targetSelectionRange":{"start":{"line":904,"character":4},"end":{"line":931,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map","--nocapture"]}}]}},{"range":{"start":{"line":933,"character":4},"end":{"line":961,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::inspect","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":933,"character":4},"end":{"line":961,"character":5}},"targetSelectionRange":{"start":{"line":933,"character":4},"end":{"line":961,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::inspect","--nocapture"]}}]}},{"range":{"start":{"line":963,"character":4},"end":{"line":994,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::map_or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":963,"character":4},"end":{"line":994,"character":5}},"targetSelectionRange":{"start":{"line":963,"character":4},"end":{"line":994,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or","--nocapture"]}}]}},{"range":{"start":{"line":996,"character":4},"end":{"line":1024,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::map_or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":996,"character":4},"end":{"line":1024,"character":5}},"targetSelectionRange":{"start":{"line":996,"character":4},"end":{"line":1024,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or_else","--nocapture"]}}]}},{"range":{"start":{"line":1026,"character":4},"end":{"line":1058,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::ok_or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1026,"character":4},"end":{"line":1058,"character":5}},"targetSelectionRange":{"start":{"line":1026,"character":4},"end":{"line":1058,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or","--nocapture"]}}]}},{"range":{"start":{"line":1060,"character":4},"end":{"line":1088,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::ok_or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1060,"character":4},"end":{"line":1088,"character":5}},"targetSelectionRange":{"start":{"line":1060,"character":4},"end":{"line":1088,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or_else","--nocapture"]}}]}},{"range":{"start":{"line":1090,"character":4},"end":{"line":1114,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_deref","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1090,"character":4},"end":{"line":1114,"character":5}},"targetSelectionRange":{"start":{"line":1090,"character":4},"end":{"line":1114,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref","--nocapture"]}}]}},{"range":{"start":{"line":1116,"character":4},"end":{"line":1140,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_deref_mut","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1116,"character":4},"end":{"line":1140,"character":5}},"targetSelectionRange":{"start":{"line":1116,"character":4},"end":{"line":1140,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref_mut","--nocapture"]}}]}},{"range":{"start":{"line":1146,"character":4},"end":{"line":1162,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::iter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1146,"character":4},"end":{"line":1162,"character":5}},"targetSelectionRange":{"start":{"line":1146,"character":4},"end":{"line":1162,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter","--nocapture"]}}]}},{"range":{"start":{"line":1164,"character":4},"end":{"line":1183,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::iter_mut","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1164,"character":4},"end":{"line":1183,"character":5}},"targetSelectionRange":{"start":{"line":1164,"character":4},"end":{"line":1183,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter_mut","--nocapture"]}}]}},{"range":{"start":{"line":1189,"character":4},"end":{"line":1222,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::and","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1189,"character":4},"end":{"line":1222,"character":5}},"targetSelectionRange":{"start":{"line":1189,"character":4},"end":{"line":1222,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and","--nocapture"]}}]}},{"range":{"start":{"line":1224,"character":4},"end":{"line":1264,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::and_then","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1224,"character":4},"end":{"line":1264,"character":5}},"targetSelectionRange":{"start":{"line":1224,"character":4},"end":{"line":1264,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and_then","--nocapture"]}}]}},{"range":{"start":{"line":1266,"character":4},"end":{"line":1305,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::filter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1266,"character":4},"end":{"line":1305,"character":5}},"targetSelectionRange":{"start":{"line":1266,"character":4},"end":{"line":1305,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::filter","--nocapture"]}}]}},{"range":{"start":{"line":1307,"character":4},"end":{"line":1345,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1307,"character":4},"end":{"line":1345,"character":5}},"targetSelectionRange":{"start":{"line":1307,"character":4},"end":{"line":1345,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or","--nocapture"]}}]}},{"range":{"start":{"line":1347,"character":4},"end":{"line":1372,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1347,"character":4},"end":{"line":1372,"character":5}},"targetSelectionRange":{"start":{"line":1347,"character":4},"end":{"line":1372,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or_else","--nocapture"]}}]}},{"range":{"start":{"line":1374,"character":4},"end":{"line":1407,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::xor","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1374,"character":4},"end":{"line":1407,"character":5}},"targetSelectionRange":{"start":{"line":1374,"character":4},"end":{"line":1407,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::xor","--nocapture"]}}]}},{"range":{"start":{"line":1413,"character":4},"end":{"line":1444,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::insert","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1413,"character":4},"end":{"line":1444,"character":5}},"targetSelectionRange":{"start":{"line":1413,"character":4},"end":{"line":1444,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::insert","--nocapture"]}}]}},{"range":{"start":{"line":1446,"character":4},"end":{"line":1480,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::get_or_insert","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1446,"character":4},"end":{"line":1480,"character":5}},"targetSelectionRange":{"start":{"line":1446,"character":4},"end":{"line":1480,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert","--nocapture"]}}]}},{"range":{"start":{"line":1482,"character":4},"end":{"line":1513,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::get_or_insert_default","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1482,"character":4},"end":{"line":1513,"character":5}},"targetSelectionRange":{"start":{"line":1482,"character":4},"end":{"line":1513,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_default","--nocapture"]}}]}},{"range":{"start":{"line":1515,"character":4},"end":{"line":1549,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::get_or_insert_with","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1515,"character":4},"end":{"line":1549,"character":5}},"targetSelectionRange":{"start":{"line":1515,"character":4},"end":{"line":1549,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_with","--nocapture"]}}]}},{"range":{"start":{"line":1555,"character":4},"end":{"line":1576,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::take","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1555,"character":4},"end":{"line":1576,"character":5}},"targetSelectionRange":{"start":{"line":1555,"character":4},"end":{"line":1576,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::take","--nocapture"]}}]}},{"range":{"start":{"line":1578,"character":4},"end":{"line":1600,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::replace","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1578,"character":4},"end":{"line":1600,"character":5}},"targetSelectionRange":{"start":{"line":1578,"character":4},"end":{"line":1600,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::replace","--nocapture"]}}]}},{"range":{"start":{"line":1602,"character":4},"end":{"line":1630,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::contains","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1602,"character":4},"end":{"line":1630,"character":5}},"targetSelectionRange":{"start":{"line":1602,"character":4},"end":{"line":1630,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::contains","--nocapture"]}}]}},{"range":{"start":{"line":1632,"character":4},"end":{"line":1658,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::zip","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1632,"character":4},"end":{"line":1658,"character":5}},"targetSelectionRange":{"start":{"line":1632,"character":4},"end":{"line":1658,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip","--nocapture"]}}]}},{"range":{"start":{"line":1660,"character":4},"end":{"line":1701,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::zip_with","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1660,"character":4},"end":{"line":1701,"character":5}},"targetSelectionRange":{"start":{"line":1660,"character":4},"end":{"line":1701,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip_with","--nocapture"]}}]}},{"range":{"start":{"line":1705,"character":4},"end":{"line":1728,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<(T,U)>::unzip","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1705,"character":4},"end":{"line":1728,"character":5}},"targetSelectionRange":{"start":{"line":1705,"character":4},"end":{"line":1728,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<(T,U)>::unzip","--nocapture"]}}]}},{"range":{"start":{"line":1732,"character":4},"end":{"line":1757,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&T>::copied","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1732,"character":4},"end":{"line":1757,"character":5}},"targetSelectionRange":{"start":{"line":1732,"character":4},"end":{"line":1757,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::copied","--nocapture"]}}]}},{"range":{"start":{"line":1759,"character":4},"end":{"line":1782,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&T>::cloned","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1759,"character":4},"end":{"line":1782,"character":5}},"targetSelectionRange":{"start":{"line":1759,"character":4},"end":{"line":1782,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::cloned","--nocapture"]}}]}},{"range":{"start":{"line":1786,"character":4},"end":{"line":1809,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&mutT>::copied","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1786,"character":4},"end":{"line":1809,"character":5}},"targetSelectionRange":{"start":{"line":1786,"character":4},"end":{"line":1809,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::copied","--nocapture"]}}]}},{"range":{"start":{"line":1811,"character":4},"end":{"line":1834,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&mutT>::cloned","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1811,"character":4},"end":{"line":1834,"character":5}},"targetSelectionRange":{"start":{"line":1811,"character":4},"end":{"line":1834,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::cloned","--nocapture"]}}]}},{"range":{"start":{"line":1838,"character":4},"end":{"line":1863,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<Result<T,E>>::transpose","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1838,"character":4},"end":{"line":1863,"character":5}},"targetSelectionRange":{"start":{"line":1838,"character":4},"end":{"line":1863,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Result<T,E>>::transpose","--nocapture"]}}]}},{"range":{"start":{"line":1906,"character":4},"end":{"line":1917,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::default","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1906,"character":4},"end":{"line":1917,"character":5}},"targetSelectionRange":{"start":{"line":1906,"character":4},"end":{"line":1917,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::default","--nocapture"]}}]}},{"range":{"start":{"line":1925,"character":4},"end":{"line":1941,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::into_iter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1925,"character":4},"end":{"line":1941,"character":5}},"targetSelectionRange":{"start":{"line":1925,"character":4},"end":{"line":1941,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::into_iter","--nocapture"]}}]}},{"range":{"start":{"line":1967,"character":4},"end":{"line":1978,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::from","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1967,"character":4},"end":{"line":1978,"character":5}},"targetSelectionRange":{"start":{"line":1967,"character":4},"end":{"line":1978,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::from","--nocapture"]}}]}},{"range":{"start":{"line":1984,"character":4},"end":{"line":2006,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&T>::from","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1984,"character":4},"end":{"line":2006,"character":5}},"targetSelectionRange":{"start":{"line":1984,"character":4},"end":{"line":2006,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::from","--nocapture"]}}]}},{"range":{"start":{"line":2012,"character":4},"end":{"line":2029,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&mutT>::from","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":2012,"character":4},"end":{"line":2029,"character":5}},"targetSelectionRange":{"start":{"line":2012,"character":4},"end":{"line":2029,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::from","--nocapture"]}}]}},{"range":{"start":{"line":2208,"character":4},"end":{"line":2274,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<V>::from_iter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":2208,"character":4},"end":{"line":2274,"character":5}},"targetSelectionRange":{"start":{"line":2208,"character":4},"end":{"line":2274,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<V>::from_iter","--nocapture"]}}]}},{"range":{"start":{"line":2322,"character":4},"end":{"line":2354,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<Option<T>>::flatten","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":2322,"character":4},"end":{"line":2354,"character":5}},"targetSelectionRange":{"start":{"line":2322,"character":4},"end":{"line":2354,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Option<T>>::flatten","--nocapture"]}}]}},{"range":{"start":{"line":517,"character":9},"end":{"line":517,"character":15}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":517,"character":9}}}},{"range":{"start":{"line":2037,"character":7},"end":{"line":2037,"character":11}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2037,"character":7}}}},{"range":{"start":{"line":2076,"character":11},"end":{"line":2076,"character":15}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2076,"character":11}}}},{"range":{"start":{"line":2126,"character":11},"end":{"line":2126,"character":18}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2126,"character":11}}}},{"range":{"start":{"line":2167,"character":11},"end":{"line":2167,"character":19}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2167,"character":11}}}}]}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":9,"line":517},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":517},"start":{"character":9,"line":517}}},"id":4}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":4,"result":{"range":{"start":{"line":517,"character":9},"end":{"line":517,"character":15}},"command":{"title":"75 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":517,"character":9},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":532,"character":0},"end":{"line":1702,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1704,"character":0},"end":{"line":1729,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1731,"character":0},"end":{"line":1783,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1785,"character":0},"end":{"line":1835,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1837,"character":0},"end":{"line":1864,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2321,"character":0},"end":{"line":2355,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":72,"character":0},"end":{"line":77,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":79,"character":0},"end":{"line":84,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2297,"character":0},"end":{"line":2306,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2308,"character":0},"end":{"line":2314,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2206,"character":0},"end":{"line":2275,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1964,"character":0},"end":{"line":1979,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1981,"character":0},"end":{"line":2007,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2009,"character":0},"end":{"line":2030,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1880,"character":0},"end":{"line":1901,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2277,"character":0},"end":{"line":2295,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs","range":{"start":{"line":216,"character":0},"end":{"line":230,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2316,"character":0},"end":{"line":2319,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1920,"character":0},"end":{"line":1942,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1944,"character":0},"end":{"line":1952,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1954,"character":0},"end":{"line":1962,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs","range":{"start":{"line":149,"character":0},"end":{"line":157,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs","range":{"start":{"line":189,"character":0},"end":{"line":214,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1903,"character":0},"end":{"line":1918,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs","range":{"start":{"line":175,"character":4},"end":{"line":175,"character":35}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs","range":{"start":{"line":61,"character":0},"end":{"line":96,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/arc-swap-0.4.7/src/ref_cnt.rs","range":{"start":{"line":112,"character":0},"end":{"line":127,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/option.rs","range":{"start":{"line":4,"character":0},"end":{"line":14,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/calls.rs","range":{"start":{"line":9,"character":0},"end":{"line":9,"character":43}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/io.rs","range":{"start":{"line":380,"character":0},"end":{"line":386,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.10.2/src/util.rs","range":{"start":{"line":14,"character":0},"end":{"line":22,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.7.2/src/util.rs","range":{"start":{"line":12,"character":0},"end":{"line":20,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs","range":{"start":{"line":108,"character":0},"end":{"line":114,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs","range":{"start":{"line":635,"character":0},"end":{"line":653,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/ser/impls.rs","range":{"start":{"line":98,"character":0},"end":{"line":112,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/expr.rs","range":{"start":{"line":2463,"character":4},"end":{"line":2472,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs","range":{"start":{"line":647,"character":4},"end":{"line":655,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs","range":{"start":{"line":811,"character":4},"end":{"line":819,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/ty.rs","range":{"start":{"line":1057,"character":4},"end":{"line":1065,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/parse.rs","range":{"start":{"line":1037,"character":0},"end":{"line":1045,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":517,"character":9}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":7,"line":2037},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":11,"line":2037},"start":{"character":7,"line":2037}}},"id":5}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":5,"result":{"range":{"start":{"line":2037,"character":7},"end":{"line":2037,"character":11}},"command":{"title":"7 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2037,"character":7},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2036,"character":0},"end":{"line":2036,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2041,"character":0},"end":{"line":2056,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2067,"character":0},"end":{"line":2067,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2036,"character":0},"end":{"line":2036,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2065,"character":0},"end":{"line":2065,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2066,"character":0},"end":{"line":2066,"character":36}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2058,"character":0},"end":{"line":2063,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2037,"character":7}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":11,"line":2076},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":2076},"start":{"character":11,"line":2076}}},"id":6}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":6,"result":{"range":{"start":{"line":2076,"character":11},"end":{"line":2076,"character":15}},"command":{"title":"8 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2076,"character":11},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2075,"character":0},"end":{"line":2075,"character":16}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2080,"character":0},"end":{"line":2092,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2108,"character":0},"end":{"line":2109,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2111,"character":0},"end":{"line":2117,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2102,"character":0},"end":{"line":2103,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2105,"character":0},"end":{"line":2106,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2094,"character":0},"end":{"line":2100,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.9.0/src/peeking_take_while.rs","range":{"start":{"line":137,"character":0},"end":{"line":137,"character":61}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2076,"character":11}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":11,"line":2126},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":18,"line":2126},"start":{"character":11,"line":2126}}},"id":7}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":7,"result":{"range":{"start":{"line":2126,"character":11},"end":{"line":2126,"character":18}},"command":{"title":"6 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2126,"character":11},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2125,"character":0},"end":{"line":2125,"character":16}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2130,"character":0},"end":{"line":2142,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2157,"character":0},"end":{"line":2158,"character":47}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2152,"character":0},"end":{"line":2153,"character":47}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2155,"character":0},"end":{"line":2156,"character":43}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2144,"character":0},"end":{"line":2150,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2126,"character":11}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":11,"line":2167},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":19,"line":2167},"start":{"character":11,"line":2167}}},"id":8}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":8,"result":{"range":{"start":{"line":2167,"character":11},"end":{"line":2167,"character":19}},"command":{"title":"7 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2167,"character":11},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2165,"character":0},"end":{"line":2165,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2171,"character":0},"end":{"line":2183,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2199,"character":0},"end":{"line":2200,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2165,"character":0},"end":{"line":2165,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2193,"character":0},"end":{"line":2194,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2196,"character":0},"end":{"line":2197,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2185,"character":0},"end":{"line":2191,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2167,"character":11}}}}}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.code_lens./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> [{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::is_some","location":{"targetRange":{"end":{"character":5,"line":554},"start":{"character":4,"line":537}},"targetSelectionRange":{"end":{"character":5,"line":554},"start":{"character":4,"line":537}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":554},"start":{"character":4,"line":537}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some_and","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::is_some_and","location":{"targetRange":{"end":{"character":5,"line":577},"start":{"character":4,"line":556}},"targetSelectionRange":{"end":{"character":5,"line":577},"start":{"character":4,"line":556}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":577},"start":{"character":4,"line":556}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_none","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::is_none","location":{"targetRange":{"end":{"character":5,"line":597},"start":{"character":4,"line":579}},"targetSelectionRange":{"end":{"character":5,"line":597},"start":{"character":4,"line":579}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":597},"start":{"character":4,"line":579}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_ref","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_ref","location":{"targetRange":{"end":{"character":5,"line":630},"start":{"character":4,"line":603}},"targetSelectionRange":{"end":{"character":5,"line":630},"start":{"character":4,"line":603}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":630},"start":{"character":4,"line":603}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_mut","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_mut","location":{"targetRange":{"end":{"character":5,"line":652},"start":{"character":4,"line":632}},"targetSelectionRange":{"end":{"character":5,"line":652},"start":{"character":4,"line":632}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":652},"start":{"character":4,"line":632}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::expect","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::expect","location":{"targetRange":{"end":{"character":5,"line":739},"start":{"character":4,"line":692}},"targetSelectionRange":{"end":{"character":5,"line":739},"start":{"character":4,"line":692}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":739},"start":{"character":4,"line":692}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap","location":{"targetRange":{"end":{"character":5,"line":776},"start":{"character":4,"line":741}},"targetSelectionRange":{"end":{"character":5,"line":776},"start":{"character":4,"line":741}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":776},"start":{"character":4,"line":741}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_or","location":{"targetRange":{"end":{"character":5,"line":803},"start":{"character":4,"line":778}},"targetSelectionRange":{"end":{"character":5,"line":803},"start":{"character":4,"line":778}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":803},"start":{"character":4,"line":778}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_or_else","location":{"targetRange":{"end":{"character":5,"line":826},"start":{"character":4,"line":805}},"targetSelectionRange":{"end":{"character":5,"line":826},"start":{"character":4,"line":805}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":826},"start":{"character":4,"line":805}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_default","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_or_default","location":{"targetRange":{"end":{"character":5,"line":865},"start":{"character":4,"line":828}},"targetSelectionRange":{"end":{"character":5,"line":865},"start":{"character":4,"line":828}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":865},"start":{"character":4,"line":828}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_unchecked","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_unchecked","location":{"targetRange":{"end":{"character":5,"line":898},"start":{"character":4,"line":867}},"targetSelectionRange":{"end":{"character":5,"line":898},"start":{"character":4,"line":867}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":898},"start":{"character":4,"line":867}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::map","location":{"targetRange":{"end":{"character":5,"line":931},"start":{"character":4,"line":904}},"targetSelectionRange":{"end":{"character":5,"line":931},"start":{"character":4,"line":904}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":931},"start":{"character":4,"line":904}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::inspect","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::inspect","location":{"targetRange":{"end":{"character":5,"line":961},"start":{"character":4,"line":933}},"targetSelectionRange":{"end":{"character":5,"line":961},"start":{"character":4,"line":933}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":961},"start":{"character":4,"line":933}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::map_or","location":{"targetRange":{"end":{"character":5,"line":994},"start":{"character":4,"line":963}},"targetSelectionRange":{"end":{"character":5,"line":994},"start":{"character":4,"line":963}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":994},"start":{"character":4,"line":963}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::map_or_else","location":{"targetRange":{"end":{"character":5,"line":1024},"start":{"character":4,"line":996}},"targetSelectionRange":{"end":{"character":5,"line":1024},"start":{"character":4,"line":996}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1024},"start":{"character":4,"line":996}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::ok_or","location":{"targetRange":{"end":{"character":5,"line":1058},"start":{"character":4,"line":1026}},"targetSelectionRange":{"end":{"character":5,"line":1058},"start":{"character":4,"line":1026}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1058},"start":{"character":4,"line":1026}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::ok_or_else","location":{"targetRange":{"end":{"character":5,"line":1088},"start":{"character":4,"line":1060}},"targetSelectionRange":{"end":{"character":5,"line":1088},"start":{"character":4,"line":1060}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1088},"start":{"character":4,"line":1060}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_deref","location":{"targetRange":{"end":{"character":5,"line":1114},"start":{"character":4,"line":1090}},"targetSelectionRange":{"end":{"character":5,"line":1114},"start":{"character":4,"line":1090}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1114},"start":{"character":4,"line":1090}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref_mut","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_deref_mut","location":{"targetRange":{"end":{"character":5,"line":1140},"start":{"character":4,"line":1116}},"targetSelectionRange":{"end":{"character":5,"line":1140},"start":{"character":4,"line":1116}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1140},"start":{"character":4,"line":1116}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::iter","location":{"targetRange":{"end":{"character":5,"line":1162},"start":{"character":4,"line":1146}},"targetSelectionRange":{"end":{"character":5,"line":1162},"start":{"character":4,"line":1146}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1162},"start":{"character":4,"line":1146}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter_mut","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::iter_mut","location":{"targetRange":{"end":{"character":5,"line":1183},"start":{"character":4,"line":1164}},"targetSelectionRange":{"end":{"character":5,"line":1183},"start":{"character":4,"line":1164}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1183},"start":{"character":4,"line":1164}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::and","location":{"targetRange":{"end":{"character":5,"line":1222},"start":{"character":4,"line":1189}},"targetSelectionRange":{"end":{"character":5,"line":1222},"start":{"character":4,"line":1189}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1222},"start":{"character":4,"line":1189}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and_then","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::and_then","location":{"targetRange":{"end":{"character":5,"line":1264},"start":{"character":4,"line":1224}},"targetSelectionRange":{"end":{"character":5,"line":1264},"start":{"character":4,"line":1224}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1264},"start":{"character":4,"line":1224}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::filter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::filter","location":{"targetRange":{"end":{"character":5,"line":1305},"start":{"character":4,"line":1266}},"targetSelectionRange":{"end":{"character":5,"line":1305},"start":{"character":4,"line":1266}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1305},"start":{"character":4,"line":1266}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::or","location":{"targetRange":{"end":{"character":5,"line":1345},"start":{"character":4,"line":1307}},"targetSelectionRange":{"end":{"character":5,"line":1345},"start":{"character":4,"line":1307}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1345},"start":{"character":4,"line":1307}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::or_else","location":{"targetRange":{"end":{"character":5,"line":1372},"start":{"character":4,"line":1347}},"targetSelectionRange":{"end":{"character":5,"line":1372},"start":{"character":4,"line":1347}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1372},"start":{"character":4,"line":1347}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::xor","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::xor","location":{"targetRange":{"end":{"character":5,"line":1407},"start":{"character":4,"line":1374}},"targetSelectionRange":{"end":{"character":5,"line":1407},"start":{"character":4,"line":1374}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1407},"start":{"character":4,"line":1374}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::insert","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::insert","location":{"targetRange":{"end":{"character":5,"line":1444},"start":{"character":4,"line":1413}},"targetSelectionRange":{"end":{"character":5,"line":1444},"start":{"character":4,"line":1413}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1444},"start":{"character":4,"line":1413}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::get_or_insert","location":{"targetRange":{"end":{"character":5,"line":1480},"start":{"character":4,"line":1446}},"targetSelectionRange":{"end":{"character":5,"line":1480},"start":{"character":4,"line":1446}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1480},"start":{"character":4,"line":1446}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_default","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::get_or_insert_default","location":{"targetRange":{"end":{"character":5,"line":1513},"start":{"character":4,"line":1482}},"targetSelectionRange":{"end":{"character":5,"line":1513},"start":{"character":4,"line":1482}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1513},"start":{"character":4,"line":1482}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_with","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::get_or_insert_with","location":{"targetRange":{"end":{"character":5,"line":1549},"start":{"character":4,"line":1515}},"targetSelectionRange":{"end":{"character":5,"line":1549},"start":{"character":4,"line":1515}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1549},"start":{"character":4,"line":1515}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::take","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::take","location":{"targetRange":{"end":{"character":5,"line":1576},"start":{"character":4,"line":1555}},"targetSelectionRange":{"end":{"character":5,"line":1576},"start":{"character":4,"line":1555}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1576},"start":{"character":4,"line":1555}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::replace","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::replace","location":{"targetRange":{"end":{"character":5,"line":1600},"start":{"character":4,"line":1578}},"targetSelectionRange":{"end":{"character":5,"line":1600},"start":{"character":4,"line":1578}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1600},"start":{"character":4,"line":1578}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::contains","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::contains","location":{"targetRange":{"end":{"character":5,"line":1630},"start":{"character":4,"line":1602}},"targetSelectionRange":{"end":{"character":5,"line":1630},"start":{"character":4,"line":1602}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1630},"start":{"character":4,"line":1602}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::zip","location":{"targetRange":{"end":{"character":5,"line":1658},"start":{"character":4,"line":1632}},"targetSelectionRange":{"end":{"character":5,"line":1658},"start":{"character":4,"line":1632}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1658},"start":{"character":4,"line":1632}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip_with","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::zip_with","location":{"targetRange":{"end":{"character":5,"line":1701},"start":{"character":4,"line":1660}},"targetSelectionRange":{"end":{"character":5,"line":1701},"start":{"character":4,"line":1660}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1701},"start":{"character":4,"line":1660}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<(T,U)>::unzip","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<(T,U)>::unzip","location":{"targetRange":{"end":{"character":5,"line":1728},"start":{"character":4,"line":1705}},"targetSelectionRange":{"end":{"character":5,"line":1728},"start":{"character":4,"line":1705}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1728},"start":{"character":4,"line":1705}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::copied","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&T>::copied","location":{"targetRange":{"end":{"character":5,"line":1757},"start":{"character":4,"line":1732}},"targetSelectionRange":{"end":{"character":5,"line":1757},"start":{"character":4,"line":1732}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1757},"start":{"character":4,"line":1732}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::cloned","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&T>::cloned","location":{"targetRange":{"end":{"character":5,"line":1782},"start":{"character":4,"line":1759}},"targetSelectionRange":{"end":{"character":5,"line":1782},"start":{"character":4,"line":1759}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1782},"start":{"character":4,"line":1759}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::copied","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&mutT>::copied","location":{"targetRange":{"end":{"character":5,"line":1809},"start":{"character":4,"line":1786}},"targetSelectionRange":{"end":{"character":5,"line":1809},"start":{"character":4,"line":1786}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1809},"start":{"character":4,"line":1786}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::cloned","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&mutT>::cloned","location":{"targetRange":{"end":{"character":5,"line":1834},"start":{"character":4,"line":1811}},"targetSelectionRange":{"end":{"character":5,"line":1834},"start":{"character":4,"line":1811}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1834},"start":{"character":4,"line":1811}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Result<T,E>>::transpose","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<Result<T,E>>::transpose","location":{"targetRange":{"end":{"character":5,"line":1863},"start":{"character":4,"line":1838}},"targetSelectionRange":{"end":{"character":5,"line":1863},"start":{"character":4,"line":1838}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1863},"start":{"character":4,"line":1838}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::default","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::default","location":{"targetRange":{"end":{"character":5,"line":1917},"start":{"character":4,"line":1906}},"targetSelectionRange":{"end":{"character":5,"line":1917},"start":{"character":4,"line":1906}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1917},"start":{"character":4,"line":1906}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::into_iter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::into_iter","location":{"targetRange":{"end":{"character":5,"line":1941},"start":{"character":4,"line":1925}},"targetSelectionRange":{"end":{"character":5,"line":1941},"start":{"character":4,"line":1925}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1941},"start":{"character":4,"line":1925}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::from","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::from","location":{"targetRange":{"end":{"character":5,"line":1978},"start":{"character":4,"line":1967}},"targetSelectionRange":{"end":{"character":5,"line":1978},"start":{"character":4,"line":1967}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1978},"start":{"character":4,"line":1967}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::from","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&T>::from","location":{"targetRange":{"end":{"character":5,"line":2006},"start":{"character":4,"line":1984}},"targetSelectionRange":{"end":{"character":5,"line":2006},"start":{"character":4,"line":1984}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2006},"start":{"character":4,"line":1984}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::from","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&mutT>::from","location":{"targetRange":{"end":{"character":5,"line":2029},"start":{"character":4,"line":2012}},"targetSelectionRange":{"end":{"character":5,"line":2029},"start":{"character":4,"line":2012}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2029},"start":{"character":4,"line":2012}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<V>::from_iter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<V>::from_iter","location":{"targetRange":{"end":{"character":5,"line":2274},"start":{"character":4,"line":2208}},"targetSelectionRange":{"end":{"character":5,"line":2274},"start":{"character":4,"line":2208}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2274},"start":{"character":4,"line":2208}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Option<T>>::flatten","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<Option<T>>::flatten","location":{"targetRange":{"end":{"character":5,"line":2354},"start":{"character":4,"line":2322}},"targetSelectionRange":{"end":{"character":5,"line":2354},"start":{"character":4,"line":2322}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2354},"start":{"character":4,"line":2322}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":9,"line":517},[{"range":{"end":{"character":1,"line":1702},"start":{"character":0,"line":532}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1729},"start":{"character":0,"line":1704}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1783},"start":{"character":0,"line":1731}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1835},"start":{"character":0,"line":1785}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1864},"start":{"character":0,"line":1837}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2355},"start":{"character":0,"line":2321}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":77},"start":{"character":0,"line":72}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":1,"line":84},"start":{"character":0,"line":79}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2306},"start":{"character":0,"line":2297}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2314},"start":{"character":0,"line":2308}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2275},"start":{"character":0,"line":2206}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1979},"start":{"character":0,"line":1964}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2007},"start":{"character":0,"line":1981}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2030},"start":{"character":0,"line":2009}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1901},"start":{"character":0,"line":1880}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2295},"start":{"character":0,"line":2277}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":230},"start":{"character":0,"line":216}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2319},"start":{"character":0,"line":2316}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1942},"start":{"character":0,"line":1920}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1952},"start":{"character":0,"line":1944}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1962},"start":{"character":0,"line":1954}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":157},"start":{"character":0,"line":149}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":1,"line":214},"start":{"character":0,"line":189}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs"},{"range":{"end":{"character":1,"line":1918},"start":{"character":0,"line":1903}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":35,"line":175},"start":{"character":4,"line":175}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs"},{"range":{"end":{"character":1,"line":96},"start":{"character":0,"line":61}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs"},{"range":{"end":{"character":1,"line":127},"start":{"character":0,"line":112}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/arc-swap-0.4.7/src/ref_cnt.rs"},{"range":{"end":{"character":1,"line":14},"start":{"character":0,"line":4}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/option.rs"},{"range":{"end":{"character":43,"line":9},"start":{"character":0,"line":9}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/calls.rs"},{"range":{"end":{"character":1,"line":386},"start":{"character":0,"line":380}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/io.rs"},{"range":{"end":{"character":1,"line":22},"start":{"character":0,"line":14}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.10.2/src/util.rs"},{"range":{"end":{"character":1,"line":20},"start":{"character":0,"line":12}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.7.2/src/util.rs"},{"range":{"end":{"character":1,"line":114},"start":{"character":0,"line":108}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs"},{"range":{"end":{"character":1,"line":653},"start":{"character":0,"line":635}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs"},{"range":{"end":{"character":1,"line":112},"start":{"character":0,"line":98}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/ser/impls.rs"},{"range":{"end":{"character":5,"line":2472},"start":{"character":4,"line":2463}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/expr.rs"},{"range":{"end":{"character":5,"line":655},"start":{"character":4,"line":647}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs"},{"range":{"end":{"character":5,"line":819},"start":{"character":4,"line":811}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs"},{"range":{"end":{"character":5,"line":1065},"start":{"character":4,"line":1057}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/ty.rs"},{"range":{"end":{"character":1,"line":1045},"start":{"character":0,"line":1037}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/parse.rs"}]],"command":"rust-analyzer.showReferences","title":"75 implementations"},"data":{"impls":{"position":{"character":9,"line":517},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":517},"start":{"character":9,"line":517}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":7,"line":2037},[{"range":{"end":{"character":23,"line":2036},"start":{"character":0,"line":2036}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2056},"start":{"character":0,"line":2041}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2067},"start":{"character":0,"line":2067}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":23,"line":2036},"start":{"character":0,"line":2036}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2065},"start":{"character":0,"line":2065}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":36,"line":2066},"start":{"character":0,"line":2066}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2063},"start":{"character":0,"line":2058}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}]],"command":"rust-analyzer.showReferences","title":"7 implementations"},"data":{"impls":{"position":{"character":7,"line":2037},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":11,"line":2037},"start":{"character":7,"line":2037}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":11,"line":2076},[{"range":{"end":{"character":16,"line":2075},"start":{"character":0,"line":2075}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2092},"start":{"character":0,"line":2080}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2109},"start":{"character":0,"line":2108}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2117},"start":{"character":0,"line":2111}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2103},"start":{"character":0,"line":2102}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2106},"start":{"character":0,"line":2105}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2100},"start":{"character":0,"line":2094}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":61,"line":137},"start":{"character":0,"line":137}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.9.0/src/peeking_take_while.rs"}]],"command":"rust-analyzer.showReferences","title":"8 implementations"},"data":{"impls":{"position":{"character":11,"line":2076},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":2076},"start":{"character":11,"line":2076}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":11,"line":2126},[{"range":{"end":{"character":16,"line":2125},"start":{"character":0,"line":2125}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2142},"start":{"character":0,"line":2130}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":47,"line":2158},"start":{"character":0,"line":2157}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":47,"line":2153},"start":{"character":0,"line":2152}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":43,"line":2156},"start":{"character":0,"line":2155}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2150},"start":{"character":0,"line":2144}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}]],"command":"rust-analyzer.showReferences","title":"6 implementations"},"data":{"impls":{"position":{"character":11,"line":2126},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":18,"line":2126},"start":{"character":11,"line":2126}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":11,"line":2167},[{"range":{"end":{"character":23,"line":2165},"start":{"character":0,"line":2165}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2183},"start":{"character":0,"line":2171}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2200},"start":{"character":0,"line":2199}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":23,"line":2165},"start":{"character":0,"line":2165}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2194},"start":{"character":0,"line":2193}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2197},"start":{"character":0,"line":2196}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2191},"start":{"character":0,"line":2185}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}]],"command":"rust-analyzer.showReferences","title":"7 implementations"},"data":{"impls":{"position":{"character":11,"line":2167},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":19,"line":2167},"start":{"character":11,"line":2167}}}]
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":31}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 31, "jsonrpc": "2.0", "result": "n"}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,0,22,[]],"id":32}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 32, "jsonrpc": "2.0", "result": 0}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.inlay_hints./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> []
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 1899, "start": 1877}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 1887}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(1887)}), "viewport": Object({"end": Number(1899), "start": Number(1877)})}) force_redraw=false
17:00:16 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 1887
17:00:16 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 1877, end: 1899 }
17:00:16 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> {"end":1899,"start":1877}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":33}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 33, "jsonrpc": "2.0", "result": 0}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.highlights./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> []
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":34}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 34, "jsonrpc": "2.0", "result": "n"}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,1877,1899,[]],"id":35}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 35, "jsonrpc": "2.0", "result": 0}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 22, "start": 0}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 0}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:21 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})}) force_redraw=false
17:04:21 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 1887 ==> 0
17:04:21 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 0, end: 22 }
17:04:21 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 1877 ==> 0
17:04:21 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 1899 ==> 22
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":36}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 36, "jsonrpc": "2.0", "result": 0}
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":37}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 37, "jsonrpc": "2.0", "result": "n"}
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,0,22,[]],"id":38}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 38, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 42, "start": 20}, "languageId": "rust", "buftype": "", "position": {"character": 2, "line": 20}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:30 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(2), "line": Number(20)}), "viewport": Object({"end": Number(42), "start": Number(20)})}) force_redraw=false
17:04:30 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 0 ==> 20
17:04:30 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 20, end: 42 }
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 22 ==> 42
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 0 ==> 20
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":39}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 39, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":40}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 40, "jsonrpc": "2.0", "result": "n"}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,20,42,[]],"id":41}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 41, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 62, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 6, "line": 40}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:30 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(6), "line": Number(40)}), "viewport": Object({"end": Number(62), "start": Number(40)})}) force_redraw=false
17:04:30 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 20 ==> 40
17:04:30 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 40, end: 62 }
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 42 ==> 62
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 20 ==> 40
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":42}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 42, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":43}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 43, "jsonrpc": "2.0", "result": "n"}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,40,62,[]],"id":44}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 44, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 82, "start": 60}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 60}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:31 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(60)}), "viewport": Object({"end": Number(82), "start": Number(60)})}) force_redraw=false
17:04:31 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 40 ==> 60
17:04:31 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 60, end: 82 }
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 62 ==> 82
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 40 ==> 60
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":45}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 45, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":46}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 46, "jsonrpc": "2.0", "result": "n"}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,60,82,[]],"id":47}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 47, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 101, "start": 80}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 80}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:31 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(80)}), "viewport": Object({"end": Number(101), "start": Number(80)})}) force_redraw=false
17:04:31 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 60 ==> 80
17:04:31 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 80, end: 101 }
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 82 ==> 101
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 60 ==> 80
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":48}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 48, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":49}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 49, "jsonrpc": "2.0", "result": "n"}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,80,101,[]],"id":50}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 50, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 119, "start": 99}, "languageId": "rust", "buftype": "", "position": {"character": 2, "line": 99}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:31 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(2), "line": Number(99)}), "viewport": Object({"end": Number(119), "start": Number(99)})}) force_redraw=false
17:04:31 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 80 ==> 99
17:04:31 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 99, end: 119 }
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 101 ==> 119
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 80 ==> 99
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":51}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 51, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":52}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 52, "jsonrpc": "2.0", "result": "n"}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,99,119,[]],"id":53}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 53, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 139, "start": 117}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 117}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:32 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(117)}), "viewport": Object({"end": Number(139), "start": Number(117)})}) force_redraw=false
17:04:32 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 99 ==> 117
17:04:32 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 117, end: 139 }
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 99 ==> 117
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 119 ==> 139
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":54}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 54, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":55}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 55, "jsonrpc": "2.0", "result": "n"}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,117,139,[]],"id":56}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 56, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 159, "start": 137}, "languageId": "rust", "buftype": "", "position": {"character": 2, "line": 137}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:32 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(2), "line": Number(137)}), "viewport": Object({"end": Number(159), "start": Number(137)})}) force_redraw=false
17:04:32 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 117 ==> 137
17:04:32 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 137, end: 159 }
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 117 ==> 137
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 139 ==> 159
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":57}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 57, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":58}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 58, "jsonrpc": "2.0", "result": "n"}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,137,159,[]],"id":59}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 59, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 179, "start": 157}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 157}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:32 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(157)}), "viewport": Object({"end": Number(179), "start": Number(157)})}) force_redraw=false
17:04:32 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 137 ==> 157
17:04:32 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 157, end: 179 }
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 137 ==> 157
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 159 ==> 179
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":60}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 60, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":61}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 61, "jsonrpc": "2.0", "result": "n"}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,157,179,[]],"id":62}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 62, "jsonrpc": "2.0", "result": 0}
17:04:36 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleBufEnter", "jsonrpc": "2.0", "params": {"bufnr": 1, "languageId": "rust", "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:36 INFO unnamed src/language_server_protocol.rs:2739 handle_buf_enter; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust")})
17:04:36 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_isServerRunning",1]}
17:04:36 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:36 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:36 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 157 ==> 49
17:04:39 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:39 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:39 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 50
17:04:39 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:39 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:39 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 51
17:04:39 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:39 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:39 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 50
17:04:40 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:40 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:40 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 49
20:30:13 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:13 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:13 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
20:30:13 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:13 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:13 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 49
20:30:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 50
20:30:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:16 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:16 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 51
20:30:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 29, "line": 52}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:16 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(29), "line": Number(52)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:16 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 52
20:30:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 52 ==> 51
20:30:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 50
20:30:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 49
20:30:18 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:18 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:18 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
20:30:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:19 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:19 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 49
22:39:14 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:14 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:14 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 50
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 51
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 50
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 49
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
22:39:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 49
22:39:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
22:39:18 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 47}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:18 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(47)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:18 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 47
22:39:18 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:18 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:18 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 47 ==> 48
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 75, "start": 57}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 57}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:19 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(57)}), "viewport": Object({"end": Number(75), "start": Number(57)})}) force_redraw=false
22:39:19 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 57
22:39:19 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 57, end: 75 }
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.start: 40 ==> 57
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.end: 59 ==> 75
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":63}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 63, "jsonrpc": "2.0", "result": 0}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":64}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 64, "jsonrpc": "2.0", "result": "n"}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,57,75,[]],"id":65}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 65, "jsonrpc": "2.0", "result": 0}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 58}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:19 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(58)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:19 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 57 ==> 58
22:39:19 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 40, end: 59 }
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.end: 75 ==> 59
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.start: 57 ==> 40
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":66}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 66, "jsonrpc": "2.0", "result": 0}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":67}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 67, "jsonrpc": "2.0", "result": "n"}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,40,59,[]],"id":68}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 68, "jsonrpc": "2.0", "result": 0}
16:45:09 INFO reader-None src/rpcclient.rs:241 reader-None terminated

[-- Attachment #3: Type: text/plain, Size: 290 bytes --]


This is an uncontrived, "in the wild" log file that I was C-n and
C-p'ing when I discovered this "non-problem."

I speculate at least half your users would consider this a regression,
although perhaps not one serious enough to revert your changes.  Some of
them would consider this a bug.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08 18:13       ` dick
@ 2022-09-08 18:26         ` Gregory Heytings
  2022-09-09  6:00         ` Eli Zaretskii
  1 sibling, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2022-09-08 18:26 UTC (permalink / raw)
  To: dick; +Cc: 57669


>
> This is an uncontrived, "in the wild" log file that I was C-n and 
> C-p'ing when I discovered this "non-problem."
>

I'm not sure what that file is supposed to demonstrate?  Yes, sometimes 
point moves to another column.  Why is that a problem while navigating 
through that particular file?  Is Emacs unusable?

>
> I speculate at least half your users would consider this a regression, 
> although perhaps not one serious enough to revert your changes.  Some of 
> them would consider this a bug.
>

If you have ideas to improve the situation in one way or another, feel 
free to share them.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-08 18:13       ` dick
  2022-09-08 18:26         ` Gregory Heytings
@ 2022-09-09  6:00         ` Eli Zaretskii
  2022-09-09 13:08           ` dick
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09  6:00 UTC (permalink / raw)
  To: dick; +Cc: gregory, 57669

> Cc: 57669@debbugs.gnu.org
> From: dick <dick.r.chiang@gmail.com>
> Date: Thu, 08 Sep 2022 14:13:29 -0400
> 
> This is an uncontrived, "in the wild" log file that I was C-n and
> C-p'ing when I discovered this "non-problem."

Are you saying that this log file didn't have lines whose length is in
excess of the long-line-threshold value?  Then it's a bug that we
would like to investigate, so please tell more details, and perhaps
post an example of such a file.

If the file did have such very long lines, then the question is: are
your Emacs and your patience capable of coping with editing this file
with the long-line optimizations disabled?  If the answer is YES, all
you need to do is make the value of long-line-threshold higher, or
even set it to nil, and you get what Emacs did previously.  C-n and
C-p will work correctly.  It might take them forever to do their job,
but it will be done much more accurately.

> I speculate at least half your users would consider this a regression,
> although perhaps not one serious enough to revert your changes.  Some of
> them would consider this a bug.

It is a regression if it happens in files with reasonable line length.
It is not a regression if it happens in files with very long lines,
because before the change Emacs couldn't cope with such files at all,
to the degree that would cause users kill the Emacs session.  Now such
files _can_ be edited, but with some minor features working in
sub-optimal manner.  Specifically, wrt C-n/C-p, let me remind you that
the line-move-visual = t operation that you say doesn't always work
with very long lines, didn't exist at all before Emacs 23, so at least
one solution is to turn it off, if its occasional misbehavior is
unacceptable for you.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09  6:00         ` Eli Zaretskii
@ 2022-09-09 13:08           ` dick
  2022-09-09 13:38             ` Gregory Heytings
  2022-09-09 14:12             ` Eli Zaretskii
  0 siblings, 2 replies; 54+ messages in thread
From: dick @ 2022-09-09 13:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gregory, 57669

> because before the change Emacs couldn't cope with such files at all

Oh, I know what you're trying to do.  After all Commercial Emacs's
original attempt at "making the best of a bad situation" was the impetus
for your own poke at the pig.

When 29 goes mainstream, just be prepared to auto-reply "Does your file
have a long line?" when feckless users ask, "Why did C-n go to a weird
column?"

And to be clear, you're going from "ineffable" performance to just
"underwhelming."  As of cb036a7 you still need find-file-literally for
some semblance of respectability.

OUTPUT:

Under long-line-threshold=nil find-file 62s
Under long-line-threshold=10000 find-file 27s
Under long-line-threshold=nil find-file-literally 30s
Under long-line-threshold=10000 find-file-literally 4s

INPUT: C-n through file of alternating short and long lines.

src/emacs -Q -l cl-lib --eval "                                   \
(let ((long-line-threshold 10000)                                 \
      (file (make-temp-file \"baz\")))                            \
  (cl-assert (= 80 (window-width)) t)                             \
  (with-temp-file file						  \
    (dotimes (i 100)                                              \
      (insert (make-string (if (zerop (% i 2))                    \
                               200                                \
                             (1+ long-line-threshold))            \
                 ?x) \"\n\")))	                                  \
  (dolist (config (list (cons nil (function find-file))           \
                        (cons long-line-threshold (function find-file))         \
                        (cons nil (function find-file-literally)) \
                        (cons long-line-threshold (function find-file-literally)))) \
    (let* ((long-line-threshold (car config))                     \
           (note (format \"long-line-threshold=%s %s\"            \
                         (car config) (cdr config)))              \
           (buffer (funcall (cdr config) file)))                  \
      (with-current-buffer buffer                                 \
        (show-paren-mode -1)                                      \
        (goto-char (point-min))                                   \
        (princ (format \"Under %s %ds\n\" note                    \
                  (fround (car (benchmark-run                     \
                       (while (condition-case nil                 \
                           (prog1 t (call-interactively           \
                             (function next-line))                \
                           (redisplay))                           \
                         (end-of-buffer)))))))                    \
          (function external-debugging-output)))                  \
      (kill-buffer buffer)))                                      \
   (kill-emacs))"





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 13:08           ` dick
@ 2022-09-09 13:38             ` Gregory Heytings
  2022-09-09 14:34               ` dick
  2022-09-09 14:12             ` Eli Zaretskii
  1 sibling, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 13:38 UTC (permalink / raw)
  To: dick; +Cc: Eli Zaretskii, 57669


>
> When 29 goes mainstream, just be prepared to auto-reply "Does your file 
> have a long line?" when feckless users ask, "Why did C-n go to a weird 
> column?"
>

We are prepared.

>
> And to be clear, you're going from "ineffable" performance to just 
> "underwhelming."  As of cb036a7 you still need find-file-literally for 
> some semblance of respectability.
>

Again your test case doesn't demonstrate anything useful, sorry.  You use 
a buffer with 100 lines, half of which are just one character above the 
threshold.  That's not at all representative, previous versions of Emacs 
(I tried 24, 25, 26, 27 and 28) can already edit such buffers fine.  Try 
the same with a buffer with 10 lines, each of which is 10 MB long.  Or 
with a buffer with a single 100 MB long line.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 13:08           ` dick
  2022-09-09 13:38             ` Gregory Heytings
@ 2022-09-09 14:12             ` Eli Zaretskii
  2022-09-09 15:04               ` dick
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 14:12 UTC (permalink / raw)
  To: dick; +Cc: gregory, 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: gregory@heytings.org,  57669@debbugs.gnu.org
> Date: Fri, 09 Sep 2022 09:08:46 -0400
> 
> After all Commercial Emacs's original attempt at "making the best of
> a bad situation" was the impetus for your own poke at the pig.

This has NIH written all over it.

> And to be clear, you're going from "ineffable" performance to just
> "underwhelming."  As of cb036a7 you still need find-file-literally for
> some semblance of respectability.
> 
> OUTPUT:
> 
> Under long-line-threshold=nil find-file 62s
> Under long-line-threshold=10000 find-file 27s
> Under long-line-threshold=nil find-file-literally 30s
> Under long-line-threshold=10000 find-file-literally 4s

It should be clear that comparing performance for 10000-character
lines with performance for 10001-character lines will produce only
mild speedups (but two-fold speedup is not to be ignored).  In the
wild we see files with much longer lines, like tens of MBs.  So if you
want to be fair, measure the performance when lines are much longer
than the threshold.  For even more insight, see what happens to
performance as function of line length.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 13:38             ` Gregory Heytings
@ 2022-09-09 14:34               ` dick
  2022-09-09 14:39                 ` Gregory Heytings
  2022-09-09 15:49                 ` Eli Zaretskii
  0 siblings, 2 replies; 54+ messages in thread
From: dick @ 2022-09-09 14:34 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

> Try the same with a buffer with 10 lines, each of which is 10 MB long.

I don't have the patience for 10MB.  How about 0.1MB?

OUTPUT:

Under long-line-threshold=nil find-file ineffable
Under long-line-threshold=10000 find-file 99s
Under long-line-threshold=nil find-file-literally ineffable
Under long-line-threshold=10000 find-file-literally 8s

INPUT:

src/emacs -Q -l cl-lib --eval "                                   \
(let ((large-file-warning-threshold (truncate 1e9))               \
      (long-line-threshold 10000)                                 \
      (file (make-temp-file \"baz\")))                            \
  (cl-assert (= 80 (window-width)) t)                             \
  (with-temp-file file						  \
    (dotimes (i 10)                                               \
      (insert (make-string (truncate 1e5) ?x) \"\n\")))           \
  (dolist (config (list (cons nil (function find-file))           \
                        (cons long-line-threshold (function find-file))         \
                        (cons nil (function find-file-literally)) \
                        (cons long-line-threshold (function find-file-literally)))) \
    (let* ((long-line-threshold (car config))                     \
           (note (format \"long-line-threshold=%s %s\"            \
                         (car config) (cdr config)))              \
           (buffer (funcall (cdr config) file)))                  \
        (if (null (car config))                                   \
          (princ (format \"Under %s ineffable\n\" note)           \
                (function external-debugging-output))             \
        (with-current-buffer buffer                               \
          (show-paren-mode -1)                                    \
          (goto-char (point-min))                                 \
          (princ (format \"Under %s %ds\n\" note                  \
                    (fround (car (benchmark-run                   \
                         (while (condition-case nil               \
                             (prog1 t (call-interactively         \
                               (function next-line))              \
                             (redisplay))                         \
                           (end-of-buffer)))))))                  \
            (function external-debugging-output)))                \
        (kill-buffer buffer))))                                   \
   (kill-emacs))"





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 14:34               ` dick
@ 2022-09-09 14:39                 ` Gregory Heytings
  2022-09-09 15:06                   ` dick
  2022-09-09 15:49                 ` Eli Zaretskii
  1 sibling, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 14:39 UTC (permalink / raw)
  To: dick; +Cc: 57669


>
> I don't have the patience for 10MB.  How about 0.1MB?
>
> OUTPUT:
>
> Under long-line-threshold=nil find-file ineffable
> Under long-line-threshold=10000 find-file 99s
> Under long-line-threshold=nil find-file-literally ineffable
> Under long-line-threshold=10000 find-file-literally 8s
>

And what's your conclusion now?  BTW, actually calculating the time 
instead of writing "ineffable" because it takes too long would be useful.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 14:12             ` Eli Zaretskii
@ 2022-09-09 15:04               ` dick
  2022-09-09 15:19                 ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 15:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gregory, 57669

> This has NIH written all over it.

You mean GNU Emacs suffers from NIH, or Commercial Emacs?

The Commercial Emacs long lines fix *preceded* GNU's by about six months
(and I might add, did so without resorting to the blunt instrument of
narrowing).

The proposer of the GNU Emacs fix even paraphrased Commercial Emacs
when he said:

  Perfect is the enemy of good.  Emacs users have been plagued for decades
  by this bug.[1]

See [2],[3] from where his words might have found inspiration.

To be clear, I'm not aggrieved.  I just want everyone to understand that
NIH is too unmeditated an accusation.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?msg=119;bug=56393
[2] https://youtu.be/5C3wB3xiMmU?t=80
[3] https://youtu.be/5C3wB3xiMmU?t=290





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 14:39                 ` Gregory Heytings
@ 2022-09-09 15:06                   ` dick
  2022-09-09 15:41                     ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 15:06 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

> And what's your conclusion now?

The same?  I'll repeat:

  And to be clear, you're going from "ineffable" performance to just
  "underwhelming."  As of cb036a7 you still need find-file-literally for
  some semblance of respectability.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:04               ` dick
@ 2022-09-09 15:19                 ` Gregory Heytings
  2022-09-09 15:52                   ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 15:19 UTC (permalink / raw)
  To: dick; +Cc: Eli Zaretskii, 57669


>
> The Commercial Emacs long lines fix *preceded* GNU's by about six months 
> (and I might add, did so without resorting to the blunt instrument of 
> narrowing).
>

As I told you yesterday (privately), Commercial Emacs performs much worse 
than what is now on master with respect to that bug.

>
> The proposer of the GNU Emacs fix even paraphrased Commercial Emacs
>

???  I did not even know that a proposed fix existed in "Commercial 
Emacs".  And how could your proposed fix have been an inspiration in any 
way?  As you yourself write two lines above you "do not resort to the 
blunt instrument of narrowing".

>
> To be clear, I'm not aggrieved.
>

To be clear, you seem to be.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:06                   ` dick
@ 2022-09-09 15:41                     ` Gregory Heytings
  2022-09-09 16:30                       ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 15:41 UTC (permalink / raw)
  To: dick; +Cc: 57669


>> And what's your conclusion now?
>
> The same?  I'll repeat:
>
> And to be clear, you're going from "ineffable" performance to just 
> "underwhelming."  As of cb036a7 you still need find-file-literally for 
> some semblance of respectability.
>

A rather strange conclusion.  Open a 1 MB file with short lines (under 80 
chars) and use your benchmark on such a file.  You'll see that scrolling 
through the whole buffer, one line at a time, takes quite some time, too. 
Here it takes about 20 seconds, and your benchmark (with find-file and 10 
lines that are each 100K characters) takes 120 seconds.  That's much 
better than "just underwhelming", isn't it?

Not to mention that such a benchmark is itself not representative of an 
actual use of an editor.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 14:34               ` dick
  2022-09-09 14:39                 ` Gregory Heytings
@ 2022-09-09 15:49                 ` Eli Zaretskii
  2022-09-09 15:58                   ` Gregory Heytings
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 15:49 UTC (permalink / raw)
  To: dick; +Cc: gregory, 57669

> Cc: 57669@debbugs.gnu.org
> From: dick <dick.r.chiang@gmail.com>
> Date: Fri, 09 Sep 2022 10:34:28 -0400
> 
> > Try the same with a buffer with 10 lines, each of which is 10 MB long.
> 
> I don't have the patience for 10MB.  How about 0.1MB?
> 
> OUTPUT:
> 
> Under long-line-threshold=nil find-file ineffable
> Under long-line-threshold=10000 find-file 99s

This means on average 1 sec per C-n.  Which is tolerable.

> Under long-line-threshold=nil find-file-literally ineffable
> Under long-line-threshold=10000 find-file-literally 8s

We know that visiting a file literally makes this much faster, but it
also loses a lot of features that we prefer not to lose.  Like display
of non-ASCII characters, for example.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:19                 ` Gregory Heytings
@ 2022-09-09 15:52                   ` dick
  2022-09-09 16:03                     ` Eli Zaretskii
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 15:52 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: Eli Zaretskii, 57669

> Commercial Emacs performs much worse

I dunno.  As of 103caad, Commercial runs through the 100-line test in
3s, about the same as GNU with find-file-literally and non-nil
long-lines-threshold.

I never said your method was inspired by mine, merely your words
in describing the long lines situation, and your motivation to even
tackle the problem.  I would have never thought to bring to bear a
seemingly unrelated thing like narrowing.  I was impressed, although the
impedance mismatch of your creative solution is becoming more obvious.

You're right, though.  Boy, am I am hopping mad.






^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:49                 ` Eli Zaretskii
@ 2022-09-09 15:58                   ` Gregory Heytings
  2022-09-09 16:04                     ` Eli Zaretskii
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 15:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669, dick


>> Under long-line-threshold=10000 find-file 99s
>
> This means on average 1 sec per C-n.  Which is tolerable.
>

The buffer contains ten lines each of which is 100K long, so C-n is called 
much more than 100 times, it is called ~10000 times.  So that's actually 
~10 ms per C-n.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:52                   ` dick
@ 2022-09-09 16:03                     ` Eli Zaretskii
  2022-09-09 16:06                       ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 16:03 UTC (permalink / raw)
  To: dick; +Cc: gregory, 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  57669@debbugs.gnu.org
> Date: Fri, 09 Sep 2022 11:52:00 -0400
> 
> > Commercial Emacs performs much worse
> 
> I dunno.  As of 103caad, Commercial runs through the 100-line test in
> 3s, about the same as GNU with find-file-literally and non-nil
> long-lines-threshold.

I'm aware of your "solution", and it is unacceptable.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:58                   ` Gregory Heytings
@ 2022-09-09 16:04                     ` Eli Zaretskii
  0 siblings, 0 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 16:04 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669, dick.r.chiang

> Date: Fri, 09 Sep 2022 15:58:50 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: dick <dick.r.chiang@gmail.com>, 57669@debbugs.gnu.org
> 
> 
> >> Under long-line-threshold=10000 find-file 99s
> >
> > This means on average 1 sec per C-n.  Which is tolerable.
> >
> 
> The buffer contains ten lines each of which is 100K long, so C-n is called 
> much more than 100 times, it is called ~10000 times.  So that's actually 
> ~10 ms per C-n.

Even better.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 16:03                     ` Eli Zaretskii
@ 2022-09-09 16:06                       ` Gregory Heytings
  2022-09-09 16:19                         ` Eli Zaretskii
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 16:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669, dick


>>> Commercial Emacs performs much worse
>>
>> I dunno.  As of 103caad, Commercial runs through the 100-line test in 
>> 3s, about the same as GNU with find-file-literally and non-nil 
>> long-lines-threshold.
>
> I'm aware of your "solution", and it is unacceptable.
>

I'm not, I asked him a few pointers, and he replied with the hash of a 
commit which disables what exists on master.  Perhaps there's something 
useful in his solution, even if it is unacceptable?  If you already know 
what it is, can you perhaps describe it in a few words?





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 16:06                       ` Gregory Heytings
@ 2022-09-09 16:19                         ` Eli Zaretskii
  2022-09-09 16:25                           ` Gregory Heytings
  2022-09-09 17:44                           ` dick
  0 siblings, 2 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 16:19 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669, dick.r.chiang

> Date: Fri, 09 Sep 2022 16:06:57 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: dick <dick.r.chiang@gmail.com>, 57669@debbugs.gnu.org
> 
> > I'm aware of your "solution", and it is unacceptable.
> 
> I'm not, I asked him a few pointers, and he replied with the hash of a 
> commit which disables what exists on master.

The code is there, you can read it.  Don't just rely on my
conclusions, because I may be wrong.

> Perhaps there's something useful in his solution, even if it is
> unacceptable?  If you already know what it is, can you perhaps
> describe it in a few words?

In a nutshell, his changes disable too many features of the GUI
display (the ones that make the Emacs display slow with long lines),
and they disable those features _always_, not just when the lines are
long.

And that is _after_ you factor out changes that are plain wrong,
because he simply didn't understand what the code does well enough.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 16:19                         ` Eli Zaretskii
@ 2022-09-09 16:25                           ` Gregory Heytings
  2022-09-09 17:44                           ` dick
  1 sibling, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 16:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669, dick.r.chiang


>> I'm not, I asked him a few pointers, and he replied with the hash of a 
>> commit which disables what exists on master.
>
> The code is there, you can read it.
>

I confess I don't have the patience to do that.  I already don't have as 
much free time as I'd like to devote to Emacs, so I'd better spend it 
wisely.

>
> In a nutshell, his changes disable too many features of the GUI display 
> (the ones that make the Emacs display slow with long lines), and they 
> disable those features _always_, not just when the lines are long.
>

Okay, that's not the right way to do it, indeed.

Dick, if you feel the above doesn't do justice to your code, feel free to 
elaborate on your chosen strategy, either here or privately.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 15:41                     ` Gregory Heytings
@ 2022-09-09 16:30                       ` dick
  2022-09-09 16:42                         ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 16:30 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

[-- Attachment #1: Type: text/plain, Size: 32 bytes --]

> A rather strange conclusion.


[-- Attachment #2: languageclient.out --]
[-- Type: text/plain, Size: 584464 bytes --]

#######
LanguageClient 0.1.161
#######
16:30:46 DEBUG unnamed src/language_client.rs:108 state: null ==> {"capabilities":{},"code_lens":{},"diagnostics":{},"highlight_match_ids":[],"highlight_source":null,"highlights":{},"highlights_placed":{},"initialization_options":null,"inlay_hints":{},"last_cursor_line":0,"last_line_diagnostic":" ","logger":{"level":"DEBUG","path":"/tmp/shiz"},"namespace_ids":{},"registrations":[],"roots":{},"semantic_highlights":{},"semantic_scope_to_hl_group_table":{},"semantic_scopes":{},"stashed_code_action_actions":[],"text_documents":{},"text_documents_metadata":{},"user_handlers":{},"viewports":{}}
16:30:46 INFO unnamed src/language_server_protocol.rs:3580 settings synced
16:30:46 INFO unnamed src/language_server_protocol.rs:3607 Project root: /home/dick/LanguageClient-neovim
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:EchomsgEllipsis","params":["Project root: /home/dick/LanguageClient-neovim"]}
16:30:46 DEBUG unnamed src/language_client.rs:108 state.roots.rust: null ==> "/home/dick/LanguageClient-neovim"
16:30:46 INFO unnamed src/language_server_protocol.rs:840 initialize; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:command","params":["sign define LanguageClientWarning text= texthl=LanguageClientWarningSign","sign define LanguageClientError text= texthl=LanguageClientErrorSign","sign define LanguageClientInformation text= texthl=LanguageClientInfoSign","sign define LanguageClientHint text= texthl=LanguageClientInfoSign"]}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["s:hasSnippetSupport()"],"id":3}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 3, "jsonrpc": "2.0", "result": 0}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":false},"completion":{"completionItem":{"insertReplaceSupport":false,"snippetSupport":false}},"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"hover":{},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true},"semanticHighlightingCapabilities":{"semanticHighlighting":true},"signatureHelp":{"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true}}},"typeDefinition":{"linkSupport":true}},"workspace":{"applyEdit":true,"didChangeWatchedFiles":{"dynamicRegistration":true}}},"clientInfo":{"name":"LanguageClient-neovim","version":"0.1.161"},"processId":243451,"rootPath":"/home/dick/LanguageClient-neovim","rootUri":"file:///home/dick/LanguageClient-neovim","trace":"off"},"id":0}
16:30:46 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"selectionRangeProvider":true,"hoverProvider":true,"completionProvider":{"triggerCharacters":[":",".","'","("],"completionItem":{"labelDetailsSupport":false}},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{"]},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"declarationProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"scheme":"file","pattern":{"glob":"**/*.rs","matches":"file"}},{"scheme":"file","pattern":{"glob":"**","matches":"folder"}}]}}},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"],"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","mutable","public","reference","trait","unsafe"]},"range":true,"full":{"delta":true}},"inlayHintProvider":{"resolveProvider":true},"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true}},"serverInfo":{"name":"rust-analyzer","version":"0.0.0 (8ddb8b7e8 2022-09-03)"}}}
16:30:46 DEBUG unnamed src/language_client.rs:108 state.capabilities.rust: null ==> {"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"completionProvider":{"triggerCharacters":[":",".","'","("]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{"]},"documentRangeFormattingProvider":false,"documentSymbolProvider":true,"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","mutable","public","reference","trait","unsafe"],"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"]},"range":true},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"textDocumentSync":{"change":2,"openClose":true,"save":{}},"typeDefinitionProvider":true,"workspace":{},"workspaceSymbolProvider":true},"serverInfo":{"name":"rust-analyzer","version":"0.0.0 (8ddb8b7e8 2022-09-03)"}}
16:30:46 INFO unnamed src/language_server_protocol.rs:567 register_cm_source; language_id="rust" result=Object({"capabilities": Object({"callHierarchyProvider": Bool(true), "codeActionProvider": Object({"codeActionKinds": Array([String(""), String("quickfix"), String("refactor"), String("refactor.extract"), String("refactor.inline"), String("refactor.rewrite")]), "resolveProvider": Bool(true)}), "codeLensProvider": Object({"resolveProvider": Bool(true)}), "completionProvider": Object({"completionItem": Object({"labelDetailsSupport": Bool(false)}), "triggerCharacters": Array([String(":"), String("."), String("'"), String("(")])}), "declarationProvider": Bool(true), "definitionProvider": Bool(true), "documentFormattingProvider": Bool(true), "documentHighlightProvider": Bool(true), "documentOnTypeFormattingProvider": Object({"firstTriggerCharacter": String("="), "moreTriggerCharacter": Array([String("."), String(">"), String("{")])}), "documentRangeFormattingProvider": Bool(false), "documentSymbolProvider": Bool(true), "experimental": Object({"externalDocs": Bool(true), "hoverRange": Bool(true), "joinLines": Bool(true), "matchingBrace": Bool(true), "moveItem": Bool(true), "onEnter": Bool(true), "openCargoToml": Bool(true), "parentModule": Bool(true), "runnables": Object({"kinds": Array([String("cargo")])}), "ssr": Bool(true), "workspaceSymbolScopeKindFiltering": Bool(true)}), "foldingRangeProvider": Bool(true), "hoverProvider": Bool(true), "implementationProvider": Bool(true), "inlayHintProvider": Object({"resolveProvider": Bool(true)}), "referencesProvider": Bool(true), "renameProvider": Object({"prepareProvider": Bool(true)}), "selectionRangeProvider": Bool(true), "semanticTokensProvider": Object({"full": Object({"delta": Bool(true)}), "legend": Object({"tokenModifiers": Array([String("documentation"), String("declaration"), String("static"), String("defaultLibrary"), String("async"), String("attribute"), String("callable"), String("constant"), String("consuming"), String("controlFlow"), String("crateRoot"), String("injected"), String("intraDocLink"), String("library"), String("mutable"), String("public"), String("reference"), String("trait"), String("unsafe")]), "tokenTypes": Array([String("comment"), String("decorator"), String("enumMember"), String("enum"), String("function"), String("interface"), String("keyword"), String("macro"), String("method"), String("namespace"), String("number"), String("operator"), String("parameter"), String("property"), String("string"), String("struct"), String("typeParameter"), String("variable"), String("angle"), String("arithmetic"), String("attribute"), String("attributeBracket"), String("bitwise"), String("boolean"), String("brace"), String("bracket"), String("builtinAttribute"), String("builtinType"), String("character"), String("colon"), String("comma"), String("comparison"), String("constParameter"), String("derive"), String("deriveHelper"), String("dot"), String("escapeSequence"), String("formatSpecifier"), String("generic"), String("label"), String("lifetime"), String("logical"), String("macroBang"), String("parenthesis"), String("punctuation"), String("selfKeyword"), String("selfTypeKeyword"), String("semicolon"), String("typeAlias"), String("toolModule"), String("union"), String("unresolvedReference")])}), "range": Bool(true)}), "signatureHelpProvider": Object({"triggerCharacters": Array([String("("), String(","), String("<")])}), "textDocumentSync": Object({"change": Number(2), "openClose": Bool(true), "save": Object({})}), "typeDefinitionProvider": Bool(true), "workspace": Object({"fileOperations": Object({"willRename": Object({"filters": Array([Object({"pattern": Object({"glob": String("**/*.rs"), "matches": String("file")}), "scheme": String("file")}), Object({"pattern": Object({"glob": String("**"), "matches": String("folder")}), "scheme": String("file")})])})})}), "workspaceSymbolProvider": Bool(true)}), "serverInfo": Object({"name": String("rust-analyzer"), "version": String("0.0.0 (8ddb8b7e8 2022-09-03)")})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["exists('g:cm_matcher')"],"id":4}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 4, "jsonrpc": "2.0", "result": 0}
16:30:46 INFO unnamed src/language_server_protocol.rs:607 register_ncm2_source; language_id="rust" result=Object({"capabilities": Object({"callHierarchyProvider": Bool(true), "codeActionProvider": Object({"codeActionKinds": Array([String(""), String("quickfix"), String("refactor"), String("refactor.extract"), String("refactor.inline"), String("refactor.rewrite")]), "resolveProvider": Bool(true)}), "codeLensProvider": Object({"resolveProvider": Bool(true)}), "completionProvider": Object({"completionItem": Object({"labelDetailsSupport": Bool(false)}), "triggerCharacters": Array([String(":"), String("."), String("'"), String("(")])}), "declarationProvider": Bool(true), "definitionProvider": Bool(true), "documentFormattingProvider": Bool(true), "documentHighlightProvider": Bool(true), "documentOnTypeFormattingProvider": Object({"firstTriggerCharacter": String("="), "moreTriggerCharacter": Array([String("."), String(">"), String("{")])}), "documentRangeFormattingProvider": Bool(false), "documentSymbolProvider": Bool(true), "experimental": Object({"externalDocs": Bool(true), "hoverRange": Bool(true), "joinLines": Bool(true), "matchingBrace": Bool(true), "moveItem": Bool(true), "onEnter": Bool(true), "openCargoToml": Bool(true), "parentModule": Bool(true), "runnables": Object({"kinds": Array([String("cargo")])}), "ssr": Bool(true), "workspaceSymbolScopeKindFiltering": Bool(true)}), "foldingRangeProvider": Bool(true), "hoverProvider": Bool(true), "implementationProvider": Bool(true), "inlayHintProvider": Object({"resolveProvider": Bool(true)}), "referencesProvider": Bool(true), "renameProvider": Object({"prepareProvider": Bool(true)}), "selectionRangeProvider": Bool(true), "semanticTokensProvider": Object({"full": Object({"delta": Bool(true)}), "legend": Object({"tokenModifiers": Array([String("documentation"), String("declaration"), String("static"), String("defaultLibrary"), String("async"), String("attribute"), String("callable"), String("constant"), String("consuming"), String("controlFlow"), String("crateRoot"), String("injected"), String("intraDocLink"), String("library"), String("mutable"), String("public"), String("reference"), String("trait"), String("unsafe")]), "tokenTypes": Array([String("comment"), String("decorator"), String("enumMember"), String("enum"), String("function"), String("interface"), String("keyword"), String("macro"), String("method"), String("namespace"), String("number"), String("operator"), String("parameter"), String("property"), String("string"), String("struct"), String("typeParameter"), String("variable"), String("angle"), String("arithmetic"), String("attribute"), String("attributeBracket"), String("bitwise"), String("boolean"), String("brace"), String("bracket"), String("builtinAttribute"), String("builtinType"), String("character"), String("colon"), String("comma"), String("comparison"), String("constParameter"), String("derive"), String("deriveHelper"), String("dot"), String("escapeSequence"), String("formatSpecifier"), String("generic"), String("label"), String("lifetime"), String("logical"), String("macroBang"), String("parenthesis"), String("punctuation"), String("selfKeyword"), String("selfTypeKeyword"), String("semicolon"), String("typeAlias"), String("toolModule"), String("union"), String("unresolvedReference")])}), "range": Bool(true)}), "signatureHelpProvider": Object({"triggerCharacters": Array([String("("), String(","), String("<")])}), "textDocumentSync": Object({"change": Number(2), "openClose": Bool(true), "save": Object({})}), "typeDefinitionProvider": Bool(true), "workspace": Object({"fileOperations": Object({"willRename": Object({"filters": Array([Object({"pattern": Object({"glob": String("**/*.rs"), "matches": String("file")}), "scheme": String("file")}), Object({"pattern": Object({"glob": String("**"), "matches": String("folder")}), "scheme": String("file")})])})})}), "workspaceSymbolProvider": Bool(true)}), "serverInfo": Object({"name": String("rust-analyzer"), "version": String("0.0.0 (8ddb8b7e8 2022-09-03)")})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["exists('g:ncm2_loaded')"],"id":5}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 5, "jsonrpc": "2.0", "result": 0}
16:30:46 INFO unnamed src/language_server_protocol.rs:647 parse_semantic_scopes; language_id="rust" result=Object({"capabilities": Object({"callHierarchyProvider": Bool(true), "codeActionProvider": Object({"codeActionKinds": Array([String(""), String("quickfix"), String("refactor"), String("refactor.extract"), String("refactor.inline"), String("refactor.rewrite")]), "resolveProvider": Bool(true)}), "codeLensProvider": Object({"resolveProvider": Bool(true)}), "completionProvider": Object({"completionItem": Object({"labelDetailsSupport": Bool(false)}), "triggerCharacters": Array([String(":"), String("."), String("'"), String("(")])}), "declarationProvider": Bool(true), "definitionProvider": Bool(true), "documentFormattingProvider": Bool(true), "documentHighlightProvider": Bool(true), "documentOnTypeFormattingProvider": Object({"firstTriggerCharacter": String("="), "moreTriggerCharacter": Array([String("."), String(">"), String("{")])}), "documentRangeFormattingProvider": Bool(false), "documentSymbolProvider": Bool(true), "experimental": Object({"externalDocs": Bool(true), "hoverRange": Bool(true), "joinLines": Bool(true), "matchingBrace": Bool(true), "moveItem": Bool(true), "onEnter": Bool(true), "openCargoToml": Bool(true), "parentModule": Bool(true), "runnables": Object({"kinds": Array([String("cargo")])}), "ssr": Bool(true), "workspaceSymbolScopeKindFiltering": Bool(true)}), "foldingRangeProvider": Bool(true), "hoverProvider": Bool(true), "implementationProvider": Bool(true), "inlayHintProvider": Object({"resolveProvider": Bool(true)}), "referencesProvider": Bool(true), "renameProvider": Object({"prepareProvider": Bool(true)}), "selectionRangeProvider": Bool(true), "semanticTokensProvider": Object({"full": Object({"delta": Bool(true)}), "legend": Object({"tokenModifiers": Array([String("documentation"), String("declaration"), String("static"), String("defaultLibrary"), String("async"), String("attribute"), String("callable"), String("constant"), String("consuming"), String("controlFlow"), String("crateRoot"), String("injected"), String("intraDocLink"), String("library"), String("mutable"), String("public"), String("reference"), String("trait"), String("unsafe")]), "tokenTypes": Array([String("comment"), String("decorator"), String("enumMember"), String("enum"), String("function"), String("interface"), String("keyword"), String("macro"), String("method"), String("namespace"), String("number"), String("operator"), String("parameter"), String("property"), String("string"), String("struct"), String("typeParameter"), String("variable"), String("angle"), String("arithmetic"), String("attribute"), String("attributeBracket"), String("bitwise"), String("boolean"), String("brace"), String("bracket"), String("builtinAttribute"), String("builtinType"), String("character"), String("colon"), String("comma"), String("comparison"), String("constParameter"), String("derive"), String("deriveHelper"), String("dot"), String("escapeSequence"), String("formatSpecifier"), String("generic"), String("label"), String("lifetime"), String("logical"), String("macroBang"), String("parenthesis"), String("punctuation"), String("selfKeyword"), String("selfTypeKeyword"), String("semicolon"), String("typeAlias"), String("toolModule"), String("union"), String("unresolvedReference")])}), "range": Bool(true)}), "signatureHelpProvider": Object({"triggerCharacters": Array([String("("), String(","), String("<")])}), "textDocumentSync": Object({"change": Number(2), "openClose": Bool(true), "save": Object({})}), "typeDefinitionProvider": Bool(true), "workspace": Object({"fileOperations": Object({"willRename": Object({"filters": Array([Object({"pattern": Object({"glob": String("**/*.rs"), "matches": String("file")}), "scheme": String("file")}), Object({"pattern": Object({"glob": String("**"), "matches": String("folder")}), "scheme": String("file")})])})})}), "workspaceSymbolProvider": Bool(true)}), "serverInfo": Object({"name": String("rust-analyzer"), "version": String("0.0.0 (8ddb8b7e8 2022-09-03)")})})
16:30:46 INFO unnamed src/language_server_protocol.rs:1019 initialized; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 INFO unnamed src/language_server_protocol.rs:666 update_semantic_highlight_tables; language_id="rust"
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"initialized","params":{}}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":6}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 6, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:30:46 INFO unnamed src/language_server_protocol.rs:1946 text_document_did_open; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_isServerRunning",1]}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"rust":{"all_targets":false,"build_on_save":true,"clippy_preference":"on","wait_to_build":0}}}}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientStarted"]}




16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"LSP#text","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs"],"id":7}
16:30:46 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]}}
16:30:46 ERROR unnamed src/rpchandler.rs:27 Error handling message: Message not handled: MethodCall { jsonrpc: Some(V2), method: "workspace/configuration", params: Map({"items": Array([Object({"section": String("rust-analyzer")})])}), id: Num(0) }

Message: {"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]},"id":0}

Error: Message not handled: MethodCall { jsonrpc: Some(V2), method: "workspace/configuration", params: Map({"items": Array([Object({"section": String("rust-analyzer")})])}), id: Num(0) }
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","error":{"code":-32603,"message":"Message not handled: MethodCall { jsonrpc: Some(V2), method: \"workspace/configuration\", params: Map({\"items\": Array([Object({\"section\": String(\"rust-analyzer\")})])}), id: Num(0) }"},"id":0}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 7, "jsonrpc": "2.0", "result": ["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};", "use anyhow::{anyhow, Result};", "use crossbeam::channel::{bounded, unbounded, Receiver, Sender};", "use log::*;", "use regex::Regex;", "use serde::{de::DeserializeOwned, Serialize};", "use std::io::Write;", "use std::str::FromStr;", "use std::{", "    collections::HashMap,", "    io::BufRead,", "    sync::atomic::{AtomicU64, Ordering},", "    thread,", "    time::Duration,", "};", "", "const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;", "", "lazy_static! {", "    // this regex is used to remove some additional fields that we get from some servers, namely:", "    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.", "    static ref RE_REMOVE_EXTRA_FIELDS: Regex =", "        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();", "}", "", "#[derive(Serialize)]", "pub struct RpcClient {", "    language_id: LanguageId,", "    #[serde(skip_serializing)]", "    id: AtomicU64,", "    #[serde(skip_serializing)]", "    writer_tx: Sender<RawMessage>,", "    #[serde(skip_serializing)]", "    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,", "    pub process_id: Option<u32>,", "}", "", "impl RpcClient {", "    #[allow(clippy::new_ret_no_self)]", "    pub fn new(", "        language_id: LanguageId,", "        reader: impl BufRead + Send + 'static,", "        writer: impl Write + Send + 'static,", "        process_id: Option<u32>,", "        sink: Sender<Call>,", "        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,", "    ) -> Result<Self> {", "        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();", "", "        let language_id_clone = language_id.clone();", "        let reader_thread_name = format!(\"reader-{:?}\", language_id);", "        let on_crash_clone = on_crash.clone();", "        thread::Builder::new()", "            .name(reader_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {", "                            on_crash_clone(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);", "                }", "            })?;", "", "        let (writer_tx, writer_rx) = unbounded();", "        let writer_thread_name = format!(\"writer-{:?}\", language_id);", "        let language_id_clone = language_id.clone();", "        thread::Builder::new()", "            .name(writer_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {", "                            on_crash(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);", "                }", "            })?;", "", "        Ok(Self {", "            language_id,", "            id: AtomicU64::default(),", "            process_id,", "            reader_tx,", "            writer_tx,", "        })", "    }", "", "    pub fn call<R: DeserializeOwned>(", "        &self,", "        method: impl AsRef<str>,", "        params: impl Serialize,", "    ) -> Result<R> {", "        let method = method.as_ref();", "        let id = self.id.fetch_add(1, Ordering::SeqCst);", "        let msg = jsonrpc_core::MethodCall {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            id: jsonrpc_core::Id::Num(id),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        let (tx, rx) = bounded(1);", "        self.reader_tx.send((id, tx))?;", "        self.writer_tx.send(RawMessage::MethodCall(msg))?;", "        // TODO: duration from config.", "        match rx.recv_timeout(Duration::from_secs(60))? {", "            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),", "            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,", "            // which we don't want to show to the user and should ignore, as the result of the", "            // request that triggered this error has been invalidated by changes to the state", "            // of the server, so we must handle this error specifically.", "            jsonrpc_core::Output::Failure(err)", "                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>", "            {", "                Err(anyhow::Error::from(LSError::ContentModified))", "            }", "            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),", "        }", "    }", "", "    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {", "        let method = method.as_ref();", "", "        let msg = jsonrpc_core::Notification {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        self.writer_tx.send(RawMessage::Notification(msg))?;", "        Ok(())", "    }", "", "    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {", "        let output = match result {", "            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                result: serde_json::to_value(ok)?,", "            }),", "            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                error: err.to_rpc_error(),", "            }),", "        };", "", "        self.writer_tx.send(RawMessage::Output(output))?;", "        Ok(())", "    }", "}", "", "fn loop_read(", "    reader: impl BufRead,", "    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,", "    sink: &Sender<Call>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut pending_outputs = HashMap::new();", "", "    // Count how many consequent empty lines.", "    let mut count_empty_lines = 0;", "", "    let mut reader = reader;", "    let mut content_length = 0;", "    loop {", "        let mut message = String::new();", "        let mut line = String::new();", "        if language_id.is_some() {", "            reader.read_line(&mut line)?;", "            let line = line.trim();", "            if line.is_empty() {", "                count_empty_lines += 1;", "                if count_empty_lines > 5 {", "                    return Err(anyhow!(\"Unable to read from language server\"));", "                }", "", "                let mut buf = vec![0; content_length];", "                reader.read_exact(buf.as_mut_slice())?;", "                message = String::from_utf8(buf)?;", "            } else {", "                count_empty_lines = 0;", "                if !line.starts_with(\"Content-Length\") {", "                    continue;", "                }", "", "                let tokens: Vec<&str> = line.splitn(2, ':').collect();", "                let len = tokens", "                    .get(1)", "                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?", "                    .trim();", "                content_length = usize::from_str(len)?;", "            }", "        } else if reader.read_line(&mut message)? == 0 {", "            break;", "        }", "", "        let message = message.trim();", "        if message.is_empty() {", "            continue;", "        }", "        debug!(\"<= {:?} {}\", language_id, message);", "        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and", "        // `requestMethod` sent by Sorbet.", "        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let message = serde_json::from_str(&s);", "        if let Err(ref err) = message {", "            error!(", "                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",", "                err, s, err", "            );", "            continue;", "        }", "        // TODO: cleanup.", "        let message = message.unwrap();", "        match message {", "            RawMessage::MethodCall(method_call) => {", "                sink.send(Call::MethodCall(language_id.clone(), method_call))?;", "            }", "            RawMessage::Notification(notification) => {", "                sink.send(Call::Notification(language_id.clone(), notification))?;", "            }", "            RawMessage::Output(output) => {", "                while let Ok((id, tx)) = reader_rx.try_recv() {", "                    pending_outputs.insert(id, tx);", "                }", "", "                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {", "                    tx.send(output)", "                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;", "                }", "            }", "        };", "    }", "", "    info!(\"reader-{:?} terminated\", language_id);", "    Ok(())", "}", "", "fn loop_write(", "    writer: impl Write,", "    rx: &Receiver<RawMessage>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut writer = writer;", "", "    for msg in rx.iter() {", "        let s = serde_json::to_string(&msg)?;", "        debug!(\"=> {:?} {}\", language_id, s);", "        if language_id.is_none() {", "            // Use different convention for two reasons,", "            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim", "            // receives `content`.", "            // 2. Without last line ending, vim output handler won't be triggered.", "            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;", "        } else {", "            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;", "        };", "        writer.flush()?;", "    }", "    Ok(())", "}", "", "#[cfg(test)]", "mod test {", "    use super::RE_REMOVE_EXTRA_FIELDS;", "    use crate::types::RawMessage;", "", "    #[test]", "    // The library we're using for json-rpc doesn't accept extra fields in the structs used to", "    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so", "    // the client fails to deserialize that response.", "    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is", "    // suboptimal, so we now try to remove the extra fields we know of from the response.", "    //", "    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892", "    fn it_should_remove_extra_fields() {", "        // it removes the requestMethod field from Sorbet", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        let message =", "            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        // it removes the meta field from javascript-typescript-langserver", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "    }", "}", ""]}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["s:GetVar('LanguageClient_setOmnifunc', v:true)"],"id":8}
16:30:46 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 8, "jsonrpc": "2.0", "result": true}
16:30:46 DEBUG unnamed src/language_client.rs:108 state.text_documents./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> {"languageId":"rust","text":"use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};\nuse anyhow::{anyhow, Result};\nuse crossbeam::channel::{bounded, unbounded, Receiver, Sender};\nuse log::*;\nuse regex::Regex;\nuse serde::{de::DeserializeOwned, Serialize};\nuse std::io::Write;\nuse std::str::FromStr;\nuse std::{\n    collections::HashMap,\n    io::BufRead,\n    sync::atomic::{AtomicU64, Ordering},\n    thread,\n    time::Duration,\n};\n\nconst CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;\n\nlazy_static! {\n    // this regex is used to remove some additional fields that we get from some servers, namely:\n    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.\n    static ref RE_REMOVE_EXTRA_FIELDS: Regex =\n        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();\n}\n\n#[derive(Serialize)]\npub struct RpcClient {\n    language_id: LanguageId,\n    #[serde(skip_serializing)]\n    id: AtomicU64,\n    #[serde(skip_serializing)]\n    writer_tx: Sender<RawMessage>,\n    #[serde(skip_serializing)]\n    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,\n    pub process_id: Option<u32>,\n}\n\nimpl RpcClient {\n    #[allow(clippy::new_ret_no_self)]\n    pub fn new(\n        language_id: LanguageId,\n        reader: impl BufRead + Send + 'static,\n        writer: impl Write + Send + 'static,\n        process_id: Option<u32>,\n        sink: Sender<Call>,\n        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,\n    ) -> Result<Self> {\n        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();\n\n        let language_id_clone = language_id.clone();\n        let reader_thread_name = format!(\"reader-{:?}\", language_id);\n        let on_crash_clone = on_crash.clone();\n        thread::Builder::new()\n            .name(reader_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {\n                            on_crash_clone(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);\n                }\n            })?;\n\n        let (writer_tx, writer_rx) = unbounded();\n        let writer_thread_name = format!(\"writer-{:?}\", language_id);\n        let language_id_clone = language_id.clone();\n        thread::Builder::new()\n            .name(writer_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {\n                            on_crash(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);\n                }\n            })?;\n\n        Ok(Self {\n            language_id,\n            id: AtomicU64::default(),\n            process_id,\n            reader_tx,\n            writer_tx,\n        })\n    }\n\n    pub fn call<R: DeserializeOwned>(\n        &self,\n        method: impl AsRef<str>,\n        params: impl Serialize,\n    ) -> Result<R> {\n        let method = method.as_ref();\n        let id = self.id.fetch_add(1, Ordering::SeqCst);\n        let msg = jsonrpc_core::MethodCall {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            id: jsonrpc_core::Id::Num(id),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        let (tx, rx) = bounded(1);\n        self.reader_tx.send((id, tx))?;\n        self.writer_tx.send(RawMessage::MethodCall(msg))?;\n        // TODO: duration from config.\n        match rx.recv_timeout(Duration::from_secs(60))? {\n            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),\n            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,\n            // which we don't want to show to the user and should ignore, as the result of the\n            // request that triggered this error has been invalidated by changes to the state\n            // of the server, so we must handle this error specifically.\n            jsonrpc_core::Output::Failure(err)\n                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>\n            {\n                Err(anyhow::Error::from(LSError::ContentModified))\n            }\n            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),\n        }\n    }\n\n    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {\n        let method = method.as_ref();\n\n        let msg = jsonrpc_core::Notification {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        self.writer_tx.send(RawMessage::Notification(msg))?;\n        Ok(())\n    }\n\n    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {\n        let output = match result {\n            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                result: serde_json::to_value(ok)?,\n            }),\n            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                error: err.to_rpc_error(),\n            }),\n        };\n\n        self.writer_tx.send(RawMessage::Output(output))?;\n        Ok(())\n    }\n}\n\nfn loop_read(\n    reader: impl BufRead,\n    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,\n    sink: &Sender<Call>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut pending_outputs = HashMap::new();\n\n    // Count how many consequent empty lines.\n    let mut count_empty_lines = 0;\n\n    let mut reader = reader;\n    let mut content_length = 0;\n    loop {\n        let mut message = String::new();\n        let mut line = String::new();\n        if language_id.is_some() {\n            reader.read_line(&mut line)?;\n            let line = line.trim();\n            if line.is_empty() {\n                count_empty_lines += 1;\n                if count_empty_lines > 5 {\n                    return Err(anyhow!(\"Unable to read from language server\"));\n                }\n\n                let mut buf = vec![0; content_length];\n                reader.read_exact(buf.as_mut_slice())?;\n                message = String::from_utf8(buf)?;\n            } else {\n                count_empty_lines = 0;\n                if !line.starts_with(\"Content-Length\") {\n                    continue;\n                }\n\n                let tokens: Vec<&str> = line.splitn(2, ':').collect();\n                let len = tokens\n                    .get(1)\n                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?\n                    .trim();\n                content_length = usize::from_str(len)?;\n            }\n        } else if reader.read_line(&mut message)? == 0 {\n            break;\n        }\n\n        let message = message.trim();\n        if message.is_empty() {\n            continue;\n        }\n        debug!(\"<= {:?} {}\", language_id, message);\n        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and\n        // `requestMethod` sent by Sorbet.\n        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let message = serde_json::from_str(&s);\n        if let Err(ref err) = message {\n            error!(\n                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",\n                err, s, err\n            );\n            continue;\n        }\n        // TODO: cleanup.\n        let message = message.unwrap();\n        match message {\n            RawMessage::MethodCall(method_call) => {\n                sink.send(Call::MethodCall(language_id.clone(), method_call))?;\n            }\n            RawMessage::Notification(notification) => {\n                sink.send(Call::Notification(language_id.clone(), notification))?;\n            }\n            RawMessage::Output(output) => {\n                while let Ok((id, tx)) = reader_rx.try_recv() {\n                    pending_outputs.insert(id, tx);\n                }\n\n                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {\n                    tx.send(output)\n                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;\n                }\n            }\n        };\n    }\n\n    info!(\"reader-{:?} terminated\", language_id);\n    Ok(())\n}\n\nfn loop_write(\n    writer: impl Write,\n    rx: &Receiver<RawMessage>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut writer = writer;\n\n    for msg in rx.iter() {\n        let s = serde_json::to_string(&msg)?;\n        debug!(\"=> {:?} {}\", language_id, s);\n        if language_id.is_none() {\n            // Use different convention for two reasons,\n            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim\n            // receives `content`.\n            // 2. Without last line ending, vim output handler won't be triggered.\n            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;\n        } else {\n            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;\n        };\n        writer.flush()?;\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod test {\n    use super::RE_REMOVE_EXTRA_FIELDS;\n    use crate::types::RawMessage;\n\n    #[test]\n    // The library we're using for json-rpc doesn't accept extra fields in the structs used to\n    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so\n    // the client fails to deserialize that response.\n    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is\n    // suboptimal, so we now try to remove the extra fields we know of from the response.\n    //\n    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892\n    fn it_should_remove_extra_fields() {\n        // it removes the requestMethod field from Sorbet\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        let message =\n            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        // it removes the meta field from javascript-typescript-langserver\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n    }\n}\n","uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs","version":0}
16:30:46 INFO unnamed src/language_server_protocol.rs:1888 text_document_code_lens; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(20), "start": Number(0)})})
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:command","params":["setlocal omnifunc=LanguageClient#complete"]}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};\nuse anyhow::{anyhow, Result};\nuse crossbeam::channel::{bounded, unbounded, Receiver, Sender};\nuse log::*;\nuse regex::Regex;\nuse serde::{de::DeserializeOwned, Serialize};\nuse std::io::Write;\nuse std::str::FromStr;\nuse std::{\n    collections::HashMap,\n    io::BufRead,\n    sync::atomic::{AtomicU64, Ordering},\n    thread,\n    time::Duration,\n};\n\nconst CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;\n\nlazy_static! {\n    // this regex is used to remove some additional fields that we get from some servers, namely:\n    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.\n    static ref RE_REMOVE_EXTRA_FIELDS: Regex =\n        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();\n}\n\n#[derive(Serialize)]\npub struct RpcClient {\n    language_id: LanguageId,\n    #[serde(skip_serializing)]\n    id: AtomicU64,\n    #[serde(skip_serializing)]\n    writer_tx: Sender<RawMessage>,\n    #[serde(skip_serializing)]\n    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,\n    pub process_id: Option<u32>,\n}\n\nimpl RpcClient {\n    #[allow(clippy::new_ret_no_self)]\n    pub fn new(\n        language_id: LanguageId,\n        reader: impl BufRead + Send + 'static,\n        writer: impl Write + Send + 'static,\n        process_id: Option<u32>,\n        sink: Sender<Call>,\n        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,\n    ) -> Result<Self> {\n        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();\n\n        let language_id_clone = language_id.clone();\n        let reader_thread_name = format!(\"reader-{:?}\", language_id);\n        let on_crash_clone = on_crash.clone();\n        thread::Builder::new()\n            .name(reader_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {\n                            on_crash_clone(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);\n                }\n            })?;\n\n        let (writer_tx, writer_rx) = unbounded();\n        let writer_thread_name = format!(\"writer-{:?}\", language_id);\n        let language_id_clone = language_id.clone();\n        thread::Builder::new()\n            .name(writer_thread_name.clone())\n            .spawn(move || {\n                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {\n                    match err.downcast_ref::<std::io::Error>() {\n                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {\n                            on_crash(&language_id_clone)\n                        }\n                        _ => {}\n                    }\n\n                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);\n                }\n            })?;\n\n        Ok(Self {\n            language_id,\n            id: AtomicU64::default(),\n            process_id,\n            reader_tx,\n            writer_tx,\n        })\n    }\n\n    pub fn call<R: DeserializeOwned>(\n        &self,\n        method: impl AsRef<str>,\n        params: impl Serialize,\n    ) -> Result<R> {\n        let method = method.as_ref();\n        let id = self.id.fetch_add(1, Ordering::SeqCst);\n        let msg = jsonrpc_core::MethodCall {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            id: jsonrpc_core::Id::Num(id),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        let (tx, rx) = bounded(1);\n        self.reader_tx.send((id, tx))?;\n        self.writer_tx.send(RawMessage::MethodCall(msg))?;\n        // TODO: duration from config.\n        match rx.recv_timeout(Duration::from_secs(60))? {\n            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),\n            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,\n            // which we don't want to show to the user and should ignore, as the result of the\n            // request that triggered this error has been invalidated by changes to the state\n            // of the server, so we must handle this error specifically.\n            jsonrpc_core::Output::Failure(err)\n                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>\n            {\n                Err(anyhow::Error::from(LSError::ContentModified))\n            }\n            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),\n        }\n    }\n\n    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {\n        let method = method.as_ref();\n\n        let msg = jsonrpc_core::Notification {\n            jsonrpc: Some(jsonrpc_core::Version::V2),\n            method: method.to_owned(),\n            params: params.to_params()?,\n        };\n        self.writer_tx.send(RawMessage::Notification(msg))?;\n        Ok(())\n    }\n\n    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {\n        let output = match result {\n            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                result: serde_json::to_value(ok)?,\n            }),\n            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {\n                jsonrpc: Some(jsonrpc_core::Version::V2),\n                id: jsonrpc_core::Id::Num(id),\n                error: err.to_rpc_error(),\n            }),\n        };\n\n        self.writer_tx.send(RawMessage::Output(output))?;\n        Ok(())\n    }\n}\n\nfn loop_read(\n    reader: impl BufRead,\n    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,\n    sink: &Sender<Call>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut pending_outputs = HashMap::new();\n\n    // Count how many consequent empty lines.\n    let mut count_empty_lines = 0;\n\n    let mut reader = reader;\n    let mut content_length = 0;\n    loop {\n        let mut message = String::new();\n        let mut line = String::new();\n        if language_id.is_some() {\n            reader.read_line(&mut line)?;\n            let line = line.trim();\n            if line.is_empty() {\n                count_empty_lines += 1;\n                if count_empty_lines > 5 {\n                    return Err(anyhow!(\"Unable to read from language server\"));\n                }\n\n                let mut buf = vec![0; content_length];\n                reader.read_exact(buf.as_mut_slice())?;\n                message = String::from_utf8(buf)?;\n            } else {\n                count_empty_lines = 0;\n                if !line.starts_with(\"Content-Length\") {\n                    continue;\n                }\n\n                let tokens: Vec<&str> = line.splitn(2, ':').collect();\n                let len = tokens\n                    .get(1)\n                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?\n                    .trim();\n                content_length = usize::from_str(len)?;\n            }\n        } else if reader.read_line(&mut message)? == 0 {\n            break;\n        }\n\n        let message = message.trim();\n        if message.is_empty() {\n            continue;\n        }\n        debug!(\"<= {:?} {}\", language_id, message);\n        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and\n        // `requestMethod` sent by Sorbet.\n        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let message = serde_json::from_str(&s);\n        if let Err(ref err) = message {\n            error!(\n                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",\n                err, s, err\n            );\n            continue;\n        }\n        // TODO: cleanup.\n        let message = message.unwrap();\n        match message {\n            RawMessage::MethodCall(method_call) => {\n                sink.send(Call::MethodCall(language_id.clone(), method_call))?;\n            }\n            RawMessage::Notification(notification) => {\n                sink.send(Call::Notification(language_id.clone(), notification))?;\n            }\n            RawMessage::Output(output) => {\n                while let Ok((id, tx)) = reader_rx.try_recv() {\n                    pending_outputs.insert(id, tx);\n                }\n\n                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {\n                    tx.send(output)\n                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;\n                }\n            }\n        };\n    }\n\n    info!(\"reader-{:?} terminated\", language_id);\n    Ok(())\n}\n\nfn loop_write(\n    writer: impl Write,\n    rx: &Receiver<RawMessage>,\n    language_id: &LanguageId,\n) -> Result<()> {\n    let mut writer = writer;\n\n    for msg in rx.iter() {\n        let s = serde_json::to_string(&msg)?;\n        debug!(\"=> {:?} {}\", language_id, s);\n        if language_id.is_none() {\n            // Use different convention for two reasons,\n            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim\n            // receives `content`.\n            // 2. Without last line ending, vim output handler won't be triggered.\n            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;\n        } else {\n            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;\n        };\n        writer.flush()?;\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod test {\n    use super::RE_REMOVE_EXTRA_FIELDS;\n    use crate::types::RawMessage;\n\n    #[test]\n    // The library we're using for json-rpc doesn't accept extra fields in the structs used to\n    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so\n    // the client fails to deserialize that response.\n    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is\n    // suboptimal, so we now try to remove the extra fields we know of from the response.\n    //\n    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892\n    fn it_should_remove_extra_fields() {\n        // it removes the requestMethod field from Sorbet\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        let message =\n            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n\n        // it removes the meta field from javascript-typescript-langserver\n        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;\n        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");\n        let result: Result<RawMessage, _> = serde_json::from_str(&message);\n        assert!(result.is_ok());\n    }\n}\n","uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs","version":0}}}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_projectRoot","/home/dick/LanguageClient-neovim"]}
16:30:46 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientTextDocumentDidOpenPost"]}
16:30:46 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs"}},"id":1}
16:30:46 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":1,"error":{"code":-32801,"message":"waiting for cargo metadata or cargo check"}}
16:30:47 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":1,"method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]}}
16:30:47 INFO unnamed src/language_server_protocol.rs:2489 client_register_capability; language_id="rust" params=Object({"registrations": Array([Object({"id": String("workspace/didChangeWatchedFiles"), "method": String("workspace/didChangeWatchedFiles"), "registerOptions": Object({"watchers": Array([Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/*.rs")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.toml")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.lock")})])})})])})
16:30:47 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/*.rs
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/mod.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/server_command.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/clangd.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/gopls.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/java.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/mod.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/rust_analyzer.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_client.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_server_protocol.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/logger.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/main.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpcclient.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpchandler.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/sign.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/types.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/utils.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/viewport.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vim.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vimext.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/watcher.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-fa158a1d365cbdd8/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-4457d73fa8da0d46/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-7418c11d7db55b23/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/rls/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/libs.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/main.rs"
16:30:47 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.toml
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.toml"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.toml"
16:30:47 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.lock
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.lock"
16:30:47 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.lock"
16:30:47 DEBUG unnamed src/language_client.rs:108 state.registrations: [] ==> [{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]
16:30:47 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","result":null,"id":1}
16:30:48 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":2,"method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]}}
16:30:48 INFO unnamed src/language_server_protocol.rs:2489 client_register_capability; language_id="rust" params=Object({"registrations": Array([Object({"id": String("workspace/didChangeWatchedFiles"), "method": String("workspace/didChangeWatchedFiles"), "registerOptions": Object({"watchers": Array([Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/*.rs")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.toml")}), Object({"globPattern": String("/home/dick/LanguageClient-neovim/**/Cargo.lock")})])})})])})
16:30:48 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/*.rs
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/mod.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/config/server_command.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/clangd.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/gopls.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/java.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/mod.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/extensions/rust_analyzer.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_client.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/language_server_protocol.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/logger.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/main.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpcclient.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/rpchandler.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/sign.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/types.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/utils.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/viewport.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vim.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/vimext.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/src/watcher.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/debug/build/anyhow-fa158a1d365cbdd8/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-4457d73fa8da0d46/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/release/build/anyhow-7418c11d7db55b23/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/target/rls/debug/build/anyhow-be1327a37b4de4c6/out/probe.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/libs.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/src/main.rs"
16:30:48 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.toml
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.toml"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.toml"
16:30:48 INFO unnamed src/language_server_protocol.rs:2512 Watching glob pattern: /home/dick/LanguageClient-neovim/**/Cargo.lock
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/Cargo.lock"
16:30:48 INFO unnamed src/language_server_protocol.rs:2524 Start watching path "/home/dick/LanguageClient-neovim/tests/data/sample-rs/Cargo.lock"
16:30:48 DEBUG unnamed src/language_client.rs:108 state.registrations: [{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}] ==> [{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}},{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/dick/LanguageClient-neovim/**/*.rs"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.toml"},{"globPattern":"/home/dick/LanguageClient-neovim/**/Cargo.lock"}]}}]
16:30:48 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","result":null,"id":2}
16:31:04 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs","diagnostics":[],"version":0}}
16:31:04 INFO unnamed src/language_server_protocol.rs:2095 text_document_publish_diagnostics; params=Object({"diagnostics": Array([]), "uri": String("file:///home/dick/LanguageClient-neovim/src/rpcclient.rs"), "version": Number(0)})
16:31:04 DEBUG unnamed src/language_client.rs:108 state.diagnostics./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> []
16:31:04 INFO unnamed src/vim.rs:225 Begin setqflist
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setqflist","params":[[],"r"]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setqflist","params":[[],"a",{"title":"[LC]: diagnostics"}]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["bufnr('/home/dick/LanguageClient-neovim/src/rpcclient.rs')"],"id":9}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 9, "jsonrpc": "2.0", "result": 1}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_statusLineDiagnosticsCounts",{"E":0,"H":0,"I":0,"W":0}]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":10}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 10, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:31:04 DEBUG unnamed src/language_client.rs:108 state.highlights./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> []
16:31:04 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Null force_redraw=true
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":11}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 11, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"getbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","&filetype"],"id":12}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 12, "jsonrpc": "2.0", "result": "rust"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#position()"],"id":13}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 13, "jsonrpc": "2.0", "result": {"character": 0, "line": 0}}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#viewport()"],"id":14}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 14, "jsonrpc": "2.0", "result": {"end": 20, "start": 0}}
16:31:04 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 0, end: 20 }
16:31:04 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs: null ==> {"end":20,"start":0}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":15}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 15, "jsonrpc": "2.0", "result": 0}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#filename()"],"id":16}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 16, "jsonrpc": "2.0", "result": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#viewport()"],"id":17}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 17, "jsonrpc": "2.0", "result": {"end": 20, "start": 0}}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["bufnr('/home/dick/LanguageClient-neovim/src/rpcclient.rs')"],"id":18}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 18, "jsonrpc": "2.0", "result": 1}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"nvim_create_namespace","params":["LanguageClient_VirtualText"],"id":19}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 19, "jsonrpc": "2.0", "result": 3}
16:31:04 DEBUG unnamed src/language_client.rs:108 state.namespace_ids.LanguageClient_VirtualText: null ==> 3
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":20}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 20, "jsonrpc": "2.0", "result": "c"}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,0,20,[]],"id":21}
16:31:04 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 21, "jsonrpc": "2.0", "result": 0}
16:31:04 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientDiagnosticsChanged"]}
17:00:02 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 20, "start": 0}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 1}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:00:02 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(1)}), "viewport": Object({"end": Number(20), "start": Number(0)})}) force_redraw=false
17:00:02 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:EchoEllipsis","params":[""]}
17:00:02 DEBUG unnamed src/language_client.rs:108 state.last_line_diagnostic: " " ==> ""
17:00:02 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 0 ==> 1
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 24, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:00:03 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(24), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:00:03 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 1 ==> 49
17:00:03 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 40, end: 59 }
17:00:03 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.start: 0 ==> 40
17:00:03 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.end: 20 ==> 59
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":22}
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 22, "jsonrpc": "2.0", "result": 0}
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":23}
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 23, "jsonrpc": "2.0", "result": "n"}
17:00:03 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,40,59,[]],"id":24}
17:00:03 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 24, "jsonrpc": "2.0", "result": 0}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 1, "jsonrpc": "2.0", "method": "textDocument/definition", "params": {"bufnr": 1, "character": 45, "handle": true, "languageId": "rust", "gotoCmd": null, "line": 49, "text": ["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};", "use anyhow::{anyhow, Result};", "use crossbeam::channel::{bounded, unbounded, Receiver, Sender};", "use log::*;", "use regex::Regex;", "use serde::{de::DeserializeOwned, Serialize};", "use std::io::Write;", "use std::str::FromStr;", "use std::{", "    collections::HashMap,", "    io::BufRead,", "    sync::atomic::{AtomicU64, Ordering},", "    thread,", "    time::Duration,", "};", "", "const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;", "", "lazy_static! {", "    // this regex is used to remove some additional fields that we get from some servers, namely:", "    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.", "    static ref RE_REMOVE_EXTRA_FIELDS: Regex =", "        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();", "}", "", "#[derive(Serialize)]", "pub struct RpcClient {", "    language_id: LanguageId,", "    #[serde(skip_serializing)]", "    id: AtomicU64,", "    #[serde(skip_serializing)]", "    writer_tx: Sender<RawMessage>,", "    #[serde(skip_serializing)]", "    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,", "    pub process_id: Option<u32>,", "}", "", "impl RpcClient {", "    #[allow(clippy::new_ret_no_self)]", "    pub fn new(", "        language_id: LanguageId,", "        reader: impl BufRead + Send + 'static,", "        writer: impl Write + Send + 'static,", "        process_id: Option<u32>,", "        sink: Sender<Call>,", "        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,", "    ) -> Result<Self> {", "        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();", "", "        let language_id_clone = language_id.clone();", "        let reader_thread_name = format!(\"reader-{:?}\", language_id);", "        let on_crash_clone = on_crash.clone();", "        thread::Builder::new()", "            .name(reader_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {", "                            on_crash_clone(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);", "                }", "            })?;", "", "        let (writer_tx, writer_rx) = unbounded();", "        let writer_thread_name = format!(\"writer-{:?}\", language_id);", "        let language_id_clone = language_id.clone();", "        thread::Builder::new()", "            .name(writer_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {", "                            on_crash(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);", "                }", "            })?;", "", "        Ok(Self {", "            language_id,", "            id: AtomicU64::default(),", "            process_id,", "            reader_tx,", "            writer_tx,", "        })", "    }", "", "    pub fn call<R: DeserializeOwned>(", "        &self,", "        method: impl AsRef<str>,", "        params: impl Serialize,", "    ) -> Result<R> {", "        let method = method.as_ref();", "        let id = self.id.fetch_add(1, Ordering::SeqCst);", "        let msg = jsonrpc_core::MethodCall {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            id: jsonrpc_core::Id::Num(id),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        let (tx, rx) = bounded(1);", "        self.reader_tx.send((id, tx))?;", "        self.writer_tx.send(RawMessage::MethodCall(msg))?;", "        // TODO: duration from config.", "        match rx.recv_timeout(Duration::from_secs(60))? {", "            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),", "            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,", "            // which we don't want to show to the user and should ignore, as the result of the", "            // request that triggered this error has been invalidated by changes to the state", "            // of the server, so we must handle this error specifically.", "            jsonrpc_core::Output::Failure(err)", "                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>", "            {", "                Err(anyhow::Error::from(LSError::ContentModified))", "            }", "            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),", "        }", "    }", "", "    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {", "        let method = method.as_ref();", "", "        let msg = jsonrpc_core::Notification {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        self.writer_tx.send(RawMessage::Notification(msg))?;", "        Ok(())", "    }", "", "    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {", "        let output = match result {", "            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                result: serde_json::to_value(ok)?,", "            }),", "            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                error: err.to_rpc_error(),", "            }),", "        };", "", "        self.writer_tx.send(RawMessage::Output(output))?;", "        Ok(())", "    }", "}", "", "fn loop_read(", "    reader: impl BufRead,", "    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,", "    sink: &Sender<Call>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut pending_outputs = HashMap::new();", "", "    // Count how many consequent empty lines.", "    let mut count_empty_lines = 0;", "", "    let mut reader = reader;", "    let mut content_length = 0;", "    loop {", "        let mut message = String::new();", "        let mut line = String::new();", "        if language_id.is_some() {", "            reader.read_line(&mut line)?;", "            let line = line.trim();", "            if line.is_empty() {", "                count_empty_lines += 1;", "                if count_empty_lines > 5 {", "                    return Err(anyhow!(\"Unable to read from language server\"));", "                }", "", "                let mut buf = vec![0; content_length];", "                reader.read_exact(buf.as_mut_slice())?;", "                message = String::from_utf8(buf)?;", "            } else {", "                count_empty_lines = 0;", "                if !line.starts_with(\"Content-Length\") {", "                    continue;", "                }", "", "                let tokens: Vec<&str> = line.splitn(2, ':').collect();", "                let len = tokens", "                    .get(1)", "                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?", "                    .trim();", "                content_length = usize::from_str(len)?;", "            }", "        } else if reader.read_line(&mut message)? == 0 {", "            break;", "        }", "", "        let message = message.trim();", "        if message.is_empty() {", "            continue;", "        }", "        debug!(\"<= {:?} {}\", language_id, message);", "        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and", "        // `requestMethod` sent by Sorbet.", "        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let message = serde_json::from_str(&s);", "        if let Err(ref err) = message {", "            error!(", "                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",", "                err, s, err", "            );", "            continue;", "        }", "        // TODO: cleanup.", "        let message = message.unwrap();", "        match message {", "            RawMessage::MethodCall(method_call) => {", "                sink.send(Call::MethodCall(language_id.clone(), method_call))?;", "            }", "            RawMessage::Notification(notification) => {", "                sink.send(Call::Notification(language_id.clone(), notification))?;", "            }", "            RawMessage::Output(output) => {", "                while let Ok((id, tx)) = reader_rx.try_recv() {", "                    pending_outputs.insert(id, tx);", "                }", "", "                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {", "                    tx.send(output)", "                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;", "                }", "            }", "        };", "    }", "", "    info!(\"reader-{:?} terminated\", language_id);", "    Ok(())", "}", "", "fn loop_write(", "    writer: impl Write,", "    rx: &Receiver<RawMessage>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut writer = writer;", "", "    for msg in rx.iter() {", "        let s = serde_json::to_string(&msg)?;", "        debug!(\"=> {:?} {}\", language_id, s);", "        if language_id.is_none() {", "            // Use different convention for two reasons,", "            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim", "            // receives `content`.", "            // 2. Without last line ending, vim output handler won't be triggered.", "            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;", "        } else {", "            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;", "        };", "        writer.flush()?;", "    }", "    Ok(())", "}", "", "#[cfg(test)]", "mod test {", "    use super::RE_REMOVE_EXTRA_FIELDS;", "    use crate::types::RawMessage;", "", "    #[test]", "    // The library we're using for json-rpc doesn't accept extra fields in the structs used to", "    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so", "    // the client fails to deserialize that response.", "    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is", "    // suboptimal, so we now try to remove the extra fields we know of from the response.", "    //", "    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892", "    fn it_should_remove_extra_fields() {", "        // it removes the requestMethod field from Sorbet", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        let message =", "            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        // it removes the meta field from javascript-typescript-langserver", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "    }", "}", ""], "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:1473 text_document_definition; params=Object({"bufnr": Number(1), "character": Number(45), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "gotoCmd": Null, "handle": Bool(true), "languageId": String("rust"), "line": Number(49), "text": Array([String("use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};"), String("use anyhow::{anyhow, Result};"), String("use crossbeam::channel::{bounded, unbounded, Receiver, Sender};"), String("use log::*;"), String("use regex::Regex;"), String("use serde::{de::DeserializeOwned, Serialize};"), String("use std::io::Write;"), String("use std::str::FromStr;"), String("use std::{"), String("    collections::HashMap,"), String("    io::BufRead,"), String("    sync::atomic::{AtomicU64, Ordering},"), String("    thread,"), String("    time::Duration,"), String("};"), String(""), String("const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;"), String(""), String("lazy_static! {"), String("    // this regex is used to remove some additional fields that we get from some servers, namely:"), String("    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet."), String("    static ref RE_REMOVE_EXTRA_FIELDS: Regex ="), String("        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();"), String("}"), String(""), String("#[derive(Serialize)]"), String("pub struct RpcClient {"), String("    language_id: LanguageId,"), String("    #[serde(skip_serializing)]"), String("    id: AtomicU64,"), String("    #[serde(skip_serializing)]"), String("    writer_tx: Sender<RawMessage>,"), String("    #[serde(skip_serializing)]"), String("    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,"), String("    pub process_id: Option<u32>,"), String("}"), String(""), String("impl RpcClient {"), String("    #[allow(clippy::new_ret_no_self)]"), String("    pub fn new("), String("        language_id: LanguageId,"), String("        reader: impl BufRead + Send + 'static,"), String("        writer: impl Write + Send + 'static,"), String("        process_id: Option<u32>,"), String("        sink: Sender<Call>,"), String("        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,"), String("    ) -> Result<Self> {"), String("        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();"), String(""), String("        let language_id_clone = language_id.clone();"), String("        let reader_thread_name = format!(\"reader-{:?}\", language_id);"), String("        let on_crash_clone = on_crash.clone();"), String("        thread::Builder::new()"), String("            .name(reader_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {"), String("                            on_crash_clone(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        let (writer_tx, writer_rx) = unbounded();"), String("        let writer_thread_name = format!(\"writer-{:?}\", language_id);"), String("        let language_id_clone = language_id.clone();"), String("        thread::Builder::new()"), String("            .name(writer_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {"), String("                            on_crash(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        Ok(Self {"), String("            language_id,"), String("            id: AtomicU64::default(),"), String("            process_id,"), String("            reader_tx,"), String("            writer_tx,"), String("        })"), String("    }"), String(""), String("    pub fn call<R: DeserializeOwned>("), String("        &self,"), String("        method: impl AsRef<str>,"), String("        params: impl Serialize,"), String("    ) -> Result<R> {"), String("        let method = method.as_ref();"), String("        let id = self.id.fetch_add(1, Ordering::SeqCst);"), String("        let msg = jsonrpc_core::MethodCall {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            id: jsonrpc_core::Id::Num(id),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        let (tx, rx) = bounded(1);"), String("        self.reader_tx.send((id, tx))?;"), String("        self.writer_tx.send(RawMessage::MethodCall(msg))?;"), String("        // TODO: duration from config."), String("        match rx.recv_timeout(Duration::from_secs(60))? {"), String("            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),"), String("            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,"), String("            // which we don't want to show to the user and should ignore, as the result of the"), String("            // request that triggered this error has been invalidated by changes to the state"), String("            // of the server, so we must handle this error specifically."), String("            jsonrpc_core::Output::Failure(err)"), String("                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>"), String("            {"), String("                Err(anyhow::Error::from(LSError::ContentModified))"), String("            }"), String("            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),"), String("        }"), String("    }"), String(""), String("    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {"), String("        let method = method.as_ref();"), String(""), String("        let msg = jsonrpc_core::Notification {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        self.writer_tx.send(RawMessage::Notification(msg))?;"), String("        Ok(())"), String("    }"), String(""), String("    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {"), String("        let output = match result {"), String("            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                result: serde_json::to_value(ok)?,"), String("            }),"), String("            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                error: err.to_rpc_error(),"), String("            }),"), String("        };"), String(""), String("        self.writer_tx.send(RawMessage::Output(output))?;"), String("        Ok(())"), String("    }"), String("}"), String(""), String("fn loop_read("), String("    reader: impl BufRead,"), String("    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,"), String("    sink: &Sender<Call>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut pending_outputs = HashMap::new();"), String(""), String("    // Count how many consequent empty lines."), String("    let mut count_empty_lines = 0;"), String(""), String("    let mut reader = reader;"), String("    let mut content_length = 0;"), String("    loop {"), String("        let mut message = String::new();"), String("        let mut line = String::new();"), String("        if language_id.is_some() {"), String("            reader.read_line(&mut line)?;"), String("            let line = line.trim();"), String("            if line.is_empty() {"), String("                count_empty_lines += 1;"), String("                if count_empty_lines > 5 {"), String("                    return Err(anyhow!(\"Unable to read from language server\"));"), String("                }"), String(""), String("                let mut buf = vec![0; content_length];"), String("                reader.read_exact(buf.as_mut_slice())?;"), String("                message = String::from_utf8(buf)?;"), String("            } else {"), String("                count_empty_lines = 0;"), String("                if !line.starts_with(\"Content-Length\") {"), String("                    continue;"), String("                }"), String(""), String("                let tokens: Vec<&str> = line.splitn(2, ':').collect();"), String("                let len = tokens"), String("                    .get(1)"), String("                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?"), String("                    .trim();"), String("                content_length = usize::from_str(len)?;"), String("            }"), String("        } else if reader.read_line(&mut message)? == 0 {"), String("            break;"), String("        }"), String(""), String("        let message = message.trim();"), String("        if message.is_empty() {"), String("            continue;"), String("        }"), String("        debug!(\"<= {:?} {}\", language_id, message);"), String("        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and"), String("        // `requestMethod` sent by Sorbet."), String("        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let message = serde_json::from_str(&s);"), String("        if let Err(ref err) = message {"), String("            error!("), String("                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\","), String("                err, s, err"), String("            );"), String("            continue;"), String("        }"), String("        // TODO: cleanup."), String("        let message = message.unwrap();"), String("        match message {"), String("            RawMessage::MethodCall(method_call) => {"), String("                sink.send(Call::MethodCall(language_id.clone(), method_call))?;"), String("            }"), String("            RawMessage::Notification(notification) => {"), String("                sink.send(Call::Notification(language_id.clone(), notification))?;"), String("            }"), String("            RawMessage::Output(output) => {"), String("                while let Ok((id, tx)) = reader_rx.try_recv() {"), String("                    pending_outputs.insert(id, tx);"), String("                }"), String(""), String("                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {"), String("                    tx.send(output)"), String("                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;"), String("                }"), String("            }"), String("        };"), String("    }"), String(""), String("    info!(\"reader-{:?} terminated\", language_id);"), String("    Ok(())"), String("}"), String(""), String("fn loop_write("), String("    writer: impl Write,"), String("    rx: &Receiver<RawMessage>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut writer = writer;"), String(""), String("    for msg in rx.iter() {"), String("        let s = serde_json::to_string(&msg)?;"), String("        debug!(\"=> {:?} {}\", language_id, s);"), String("        if language_id.is_none() {"), String("            // Use different convention for two reasons,"), String("            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim"), String("            // receives `content`."), String("            // 2. Without last line ending, vim output handler won't be triggered."), String("            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;"), String("        } else {"), String("            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;"), String("        };"), String("        writer.flush()?;"), String("    }"), String("    Ok(())"), String("}"), String(""), String("#[cfg(test)]"), String("mod test {"), String("    use super::RE_REMOVE_EXTRA_FIELDS;"), String("    use crate::types::RawMessage;"), String(""), String("    #[test]"), String("    // The library we're using for json-rpc doesn't accept extra fields in the structs used to"), String("    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so"), String("    // the client fails to deserialize that response."), String("    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is"), String("    // suboptimal, so we now try to remove the extra fields we know of from the response."), String("    //"), String("    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892"), String("    fn it_should_remove_extra_fields() {"), String("        // it removes the requestMethod field from Sorbet"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        let message ="), String("            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        // it removes the meta field from javascript-typescript-langserver"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String("    }"), String("}"), String("")])})
17:00:16 INFO unnamed src/language_server_protocol.rs:1077 find_locations; params=Object({"bufnr": Number(1), "character": Number(45), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "gotoCmd": Null, "handle": Bool(true), "languageId": String("rust"), "line": Number(49), "method": String("textDocument/definition"), "text": Array([String("use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};"), String("use anyhow::{anyhow, Result};"), String("use crossbeam::channel::{bounded, unbounded, Receiver, Sender};"), String("use log::*;"), String("use regex::Regex;"), String("use serde::{de::DeserializeOwned, Serialize};"), String("use std::io::Write;"), String("use std::str::FromStr;"), String("use std::{"), String("    collections::HashMap,"), String("    io::BufRead,"), String("    sync::atomic::{AtomicU64, Ordering},"), String("    thread,"), String("    time::Duration,"), String("};"), String(""), String("const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;"), String(""), String("lazy_static! {"), String("    // this regex is used to remove some additional fields that we get from some servers, namely:"), String("    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet."), String("    static ref RE_REMOVE_EXTRA_FIELDS: Regex ="), String("        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();"), String("}"), String(""), String("#[derive(Serialize)]"), String("pub struct RpcClient {"), String("    language_id: LanguageId,"), String("    #[serde(skip_serializing)]"), String("    id: AtomicU64,"), String("    #[serde(skip_serializing)]"), String("    writer_tx: Sender<RawMessage>,"), String("    #[serde(skip_serializing)]"), String("    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,"), String("    pub process_id: Option<u32>,"), String("}"), String(""), String("impl RpcClient {"), String("    #[allow(clippy::new_ret_no_self)]"), String("    pub fn new("), String("        language_id: LanguageId,"), String("        reader: impl BufRead + Send + 'static,"), String("        writer: impl Write + Send + 'static,"), String("        process_id: Option<u32>,"), String("        sink: Sender<Call>,"), String("        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,"), String("    ) -> Result<Self> {"), String("        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();"), String(""), String("        let language_id_clone = language_id.clone();"), String("        let reader_thread_name = format!(\"reader-{:?}\", language_id);"), String("        let on_crash_clone = on_crash.clone();"), String("        thread::Builder::new()"), String("            .name(reader_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {"), String("                            on_crash_clone(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        let (writer_tx, writer_rx) = unbounded();"), String("        let writer_thread_name = format!(\"writer-{:?}\", language_id);"), String("        let language_id_clone = language_id.clone();"), String("        thread::Builder::new()"), String("            .name(writer_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {"), String("                            on_crash(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        Ok(Self {"), String("            language_id,"), String("            id: AtomicU64::default(),"), String("            process_id,"), String("            reader_tx,"), String("            writer_tx,"), String("        })"), String("    }"), String(""), String("    pub fn call<R: DeserializeOwned>("), String("        &self,"), String("        method: impl AsRef<str>,"), String("        params: impl Serialize,"), String("    ) -> Result<R> {"), String("        let method = method.as_ref();"), String("        let id = self.id.fetch_add(1, Ordering::SeqCst);"), String("        let msg = jsonrpc_core::MethodCall {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            id: jsonrpc_core::Id::Num(id),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        let (tx, rx) = bounded(1);"), String("        self.reader_tx.send((id, tx))?;"), String("        self.writer_tx.send(RawMessage::MethodCall(msg))?;"), String("        // TODO: duration from config."), String("        match rx.recv_timeout(Duration::from_secs(60))? {"), String("            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),"), String("            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,"), String("            // which we don't want to show to the user and should ignore, as the result of the"), String("            // request that triggered this error has been invalidated by changes to the state"), String("            // of the server, so we must handle this error specifically."), String("            jsonrpc_core::Output::Failure(err)"), String("                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>"), String("            {"), String("                Err(anyhow::Error::from(LSError::ContentModified))"), String("            }"), String("            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),"), String("        }"), String("    }"), String(""), String("    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {"), String("        let method = method.as_ref();"), String(""), String("        let msg = jsonrpc_core::Notification {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        self.writer_tx.send(RawMessage::Notification(msg))?;"), String("        Ok(())"), String("    }"), String(""), String("    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {"), String("        let output = match result {"), String("            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                result: serde_json::to_value(ok)?,"), String("            }),"), String("            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                error: err.to_rpc_error(),"), String("            }),"), String("        };"), String(""), String("        self.writer_tx.send(RawMessage::Output(output))?;"), String("        Ok(())"), String("    }"), String("}"), String(""), String("fn loop_read("), String("    reader: impl BufRead,"), String("    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,"), String("    sink: &Sender<Call>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut pending_outputs = HashMap::new();"), String(""), String("    // Count how many consequent empty lines."), String("    let mut count_empty_lines = 0;"), String(""), String("    let mut reader = reader;"), String("    let mut content_length = 0;"), String("    loop {"), String("        let mut message = String::new();"), String("        let mut line = String::new();"), String("        if language_id.is_some() {"), String("            reader.read_line(&mut line)?;"), String("            let line = line.trim();"), String("            if line.is_empty() {"), String("                count_empty_lines += 1;"), String("                if count_empty_lines > 5 {"), String("                    return Err(anyhow!(\"Unable to read from language server\"));"), String("                }"), String(""), String("                let mut buf = vec![0; content_length];"), String("                reader.read_exact(buf.as_mut_slice())?;"), String("                message = String::from_utf8(buf)?;"), String("            } else {"), String("                count_empty_lines = 0;"), String("                if !line.starts_with(\"Content-Length\") {"), String("                    continue;"), String("                }"), String(""), String("                let tokens: Vec<&str> = line.splitn(2, ':').collect();"), String("                let len = tokens"), String("                    .get(1)"), String("                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?"), String("                    .trim();"), String("                content_length = usize::from_str(len)?;"), String("            }"), String("        } else if reader.read_line(&mut message)? == 0 {"), String("            break;"), String("        }"), String(""), String("        let message = message.trim();"), String("        if message.is_empty() {"), String("            continue;"), String("        }"), String("        debug!(\"<= {:?} {}\", language_id, message);"), String("        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and"), String("        // `requestMethod` sent by Sorbet."), String("        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let message = serde_json::from_str(&s);"), String("        if let Err(ref err) = message {"), String("            error!("), String("                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\","), String("                err, s, err"), String("            );"), String("            continue;"), String("        }"), String("        // TODO: cleanup."), String("        let message = message.unwrap();"), String("        match message {"), String("            RawMessage::MethodCall(method_call) => {"), String("                sink.send(Call::MethodCall(language_id.clone(), method_call))?;"), String("            }"), String("            RawMessage::Notification(notification) => {"), String("                sink.send(Call::Notification(language_id.clone(), notification))?;"), String("            }"), String("            RawMessage::Output(output) => {"), String("                while let Ok((id, tx)) = reader_rx.try_recv() {"), String("                    pending_outputs.insert(id, tx);"), String("                }"), String(""), String("                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {"), String("                    tx.send(output)"), String("                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;"), String("                }"), String("            }"), String("        };"), String("    }"), String(""), String("    info!(\"reader-{:?} terminated\", language_id);"), String("    Ok(())"), String("}"), String(""), String("fn loop_write("), String("    writer: impl Write,"), String("    rx: &Receiver<RawMessage>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut writer = writer;"), String(""), String("    for msg in rx.iter() {"), String("        let s = serde_json::to_string(&msg)?;"), String("        debug!(\"=> {:?} {}\", language_id, s);"), String("        if language_id.is_none() {"), String("            // Use different convention for two reasons,"), String("            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim"), String("            // receives `content`."), String("            // 2. Without last line ending, vim output handler won't be triggered."), String("            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;"), String("        } else {"), String("            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;"), String("        };"), String("        writer.flush()?;"), String("    }"), String("    Ok(())"), String("}"), String(""), String("#[cfg(test)]"), String("mod test {"), String("    use super::RE_REMOVE_EXTRA_FIELDS;"), String("    use crate::types::RawMessage;"), String(""), String("    #[test]"), String("    // The library we're using for json-rpc doesn't accept extra fields in the structs used to"), String("    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so"), String("    // the client fails to deserialize that response."), String("    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is"), String("    // suboptimal, so we now try to remove the extra fields we know of from the response."), String("    //"), String("    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892"), String("    fn it_should_remove_extra_fields() {"), String("        // it removes the requestMethod field from Sorbet"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        let message ="), String("            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        // it removes the meta field from javascript-typescript-langserver"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String("    }"), String("}"), String("")])})
17:00:16 INFO unnamed src/language_server_protocol.rs:1993 text_document_did_change; params=Object({"bufnr": Number(1), "character": Number(45), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "gotoCmd": Null, "handle": Bool(true), "languageId": String("rust"), "line": Number(49), "method": String("textDocument/definition"), "text": Array([String("use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};"), String("use anyhow::{anyhow, Result};"), String("use crossbeam::channel::{bounded, unbounded, Receiver, Sender};"), String("use log::*;"), String("use regex::Regex;"), String("use serde::{de::DeserializeOwned, Serialize};"), String("use std::io::Write;"), String("use std::str::FromStr;"), String("use std::{"), String("    collections::HashMap,"), String("    io::BufRead,"), String("    sync::atomic::{AtomicU64, Ordering},"), String("    thread,"), String("    time::Duration,"), String("};"), String(""), String("const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;"), String(""), String("lazy_static! {"), String("    // this regex is used to remove some additional fields that we get from some servers, namely:"), String("    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet."), String("    static ref RE_REMOVE_EXTRA_FIELDS: Regex ="), String("        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();"), String("}"), String(""), String("#[derive(Serialize)]"), String("pub struct RpcClient {"), String("    language_id: LanguageId,"), String("    #[serde(skip_serializing)]"), String("    id: AtomicU64,"), String("    #[serde(skip_serializing)]"), String("    writer_tx: Sender<RawMessage>,"), String("    #[serde(skip_serializing)]"), String("    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,"), String("    pub process_id: Option<u32>,"), String("}"), String(""), String("impl RpcClient {"), String("    #[allow(clippy::new_ret_no_self)]"), String("    pub fn new("), String("        language_id: LanguageId,"), String("        reader: impl BufRead + Send + 'static,"), String("        writer: impl Write + Send + 'static,"), String("        process_id: Option<u32>,"), String("        sink: Sender<Call>,"), String("        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,"), String("    ) -> Result<Self> {"), String("        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();"), String(""), String("        let language_id_clone = language_id.clone();"), String("        let reader_thread_name = format!(\"reader-{:?}\", language_id);"), String("        let on_crash_clone = on_crash.clone();"), String("        thread::Builder::new()"), String("            .name(reader_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {"), String("                            on_crash_clone(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        let (writer_tx, writer_rx) = unbounded();"), String("        let writer_thread_name = format!(\"writer-{:?}\", language_id);"), String("        let language_id_clone = language_id.clone();"), String("        thread::Builder::new()"), String("            .name(writer_thread_name.clone())"), String("            .spawn(move || {"), String("                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {"), String("                    match err.downcast_ref::<std::io::Error>() {"), String("                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {"), String("                            on_crash(&language_id_clone)"), String("                        }"), String("                        _ => {}"), String("                    }"), String(""), String("                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);"), String("                }"), String("            })?;"), String(""), String("        Ok(Self {"), String("            language_id,"), String("            id: AtomicU64::default(),"), String("            process_id,"), String("            reader_tx,"), String("            writer_tx,"), String("        })"), String("    }"), String(""), String("    pub fn call<R: DeserializeOwned>("), String("        &self,"), String("        method: impl AsRef<str>,"), String("        params: impl Serialize,"), String("    ) -> Result<R> {"), String("        let method = method.as_ref();"), String("        let id = self.id.fetch_add(1, Ordering::SeqCst);"), String("        let msg = jsonrpc_core::MethodCall {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            id: jsonrpc_core::Id::Num(id),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        let (tx, rx) = bounded(1);"), String("        self.reader_tx.send((id, tx))?;"), String("        self.writer_tx.send(RawMessage::MethodCall(msg))?;"), String("        // TODO: duration from config."), String("        match rx.recv_timeout(Duration::from_secs(60))? {"), String("            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),"), String("            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,"), String("            // which we don't want to show to the user and should ignore, as the result of the"), String("            // request that triggered this error has been invalidated by changes to the state"), String("            // of the server, so we must handle this error specifically."), String("            jsonrpc_core::Output::Failure(err)"), String("                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>"), String("            {"), String("                Err(anyhow::Error::from(LSError::ContentModified))"), String("            }"), String("            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),"), String("        }"), String("    }"), String(""), String("    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {"), String("        let method = method.as_ref();"), String(""), String("        let msg = jsonrpc_core::Notification {"), String("            jsonrpc: Some(jsonrpc_core::Version::V2),"), String("            method: method.to_owned(),"), String("            params: params.to_params()?,"), String("        };"), String("        self.writer_tx.send(RawMessage::Notification(msg))?;"), String("        Ok(())"), String("    }"), String(""), String("    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {"), String("        let output = match result {"), String("            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                result: serde_json::to_value(ok)?,"), String("            }),"), String("            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {"), String("                jsonrpc: Some(jsonrpc_core::Version::V2),"), String("                id: jsonrpc_core::Id::Num(id),"), String("                error: err.to_rpc_error(),"), String("            }),"), String("        };"), String(""), String("        self.writer_tx.send(RawMessage::Output(output))?;"), String("        Ok(())"), String("    }"), String("}"), String(""), String("fn loop_read("), String("    reader: impl BufRead,"), String("    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,"), String("    sink: &Sender<Call>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut pending_outputs = HashMap::new();"), String(""), String("    // Count how many consequent empty lines."), String("    let mut count_empty_lines = 0;"), String(""), String("    let mut reader = reader;"), String("    let mut content_length = 0;"), String("    loop {"), String("        let mut message = String::new();"), String("        let mut line = String::new();"), String("        if language_id.is_some() {"), String("            reader.read_line(&mut line)?;"), String("            let line = line.trim();"), String("            if line.is_empty() {"), String("                count_empty_lines += 1;"), String("                if count_empty_lines > 5 {"), String("                    return Err(anyhow!(\"Unable to read from language server\"));"), String("                }"), String(""), String("                let mut buf = vec![0; content_length];"), String("                reader.read_exact(buf.as_mut_slice())?;"), String("                message = String::from_utf8(buf)?;"), String("            } else {"), String("                count_empty_lines = 0;"), String("                if !line.starts_with(\"Content-Length\") {"), String("                    continue;"), String("                }"), String(""), String("                let tokens: Vec<&str> = line.splitn(2, ':').collect();"), String("                let len = tokens"), String("                    .get(1)"), String("                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?"), String("                    .trim();"), String("                content_length = usize::from_str(len)?;"), String("            }"), String("        } else if reader.read_line(&mut message)? == 0 {"), String("            break;"), String("        }"), String(""), String("        let message = message.trim();"), String("        if message.is_empty() {"), String("            continue;"), String("        }"), String("        debug!(\"<= {:?} {}\", language_id, message);"), String("        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and"), String("        // `requestMethod` sent by Sorbet."), String("        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let message = serde_json::from_str(&s);"), String("        if let Err(ref err) = message {"), String("            error!("), String("                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\","), String("                err, s, err"), String("            );"), String("            continue;"), String("        }"), String("        // TODO: cleanup."), String("        let message = message.unwrap();"), String("        match message {"), String("            RawMessage::MethodCall(method_call) => {"), String("                sink.send(Call::MethodCall(language_id.clone(), method_call))?;"), String("            }"), String("            RawMessage::Notification(notification) => {"), String("                sink.send(Call::Notification(language_id.clone(), notification))?;"), String("            }"), String("            RawMessage::Output(output) => {"), String("                while let Ok((id, tx)) = reader_rx.try_recv() {"), String("                    pending_outputs.insert(id, tx);"), String("                }"), String(""), String("                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {"), String("                    tx.send(output)"), String("                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;"), String("                }"), String("            }"), String("        };"), String("    }"), String(""), String("    info!(\"reader-{:?} terminated\", language_id);"), String("    Ok(())"), String("}"), String(""), String("fn loop_write("), String("    writer: impl Write,"), String("    rx: &Receiver<RawMessage>,"), String("    language_id: &LanguageId,"), String(") -> Result<()> {"), String("    let mut writer = writer;"), String(""), String("    for msg in rx.iter() {"), String("        let s = serde_json::to_string(&msg)?;"), String("        debug!(\"=> {:?} {}\", language_id, s);"), String("        if language_id.is_none() {"), String("            // Use different convention for two reasons,"), String("            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim"), String("            // receives `content`."), String("            // 2. Without last line ending, vim output handler won't be triggered."), String("            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;"), String("        } else {"), String("            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;"), String("        };"), String("        writer.flush()?;"), String("    }"), String("    Ok(())"), String("}"), String(""), String("#[cfg(test)]"), String("mod test {"), String("    use super::RE_REMOVE_EXTRA_FIELDS;"), String("    use crate::types::RawMessage;"), String(""), String("    #[test]"), String("    // The library we're using for json-rpc doesn't accept extra fields in the structs used to"), String("    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so"), String("    // the client fails to deserialize that response."), String("    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is"), String("    // suboptimal, so we now try to remove the extra fields we know of from the response."), String("    //"), String("    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892"), String("    fn it_should_remove_extra_fields() {"), String("        // it removes the requestMethod field from Sorbet"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        let message ="), String("            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String(""), String("        // it removes the meta field from javascript-typescript-langserver"), String("        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;"), String("        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");"), String("        let result: Result<RawMessage, _> = serde_json::from_str(&message);"), String("        assert!(result.is_ok());"), String("    }"), String("}"), String("")])})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"LSP#text","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs"],"id":25}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 25, "jsonrpc": "2.0", "result": ["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};", "use anyhow::{anyhow, Result};", "use crossbeam::channel::{bounded, unbounded, Receiver, Sender};", "use log::*;", "use regex::Regex;", "use serde::{de::DeserializeOwned, Serialize};", "use std::io::Write;", "use std::str::FromStr;", "use std::{", "    collections::HashMap,", "    io::BufRead,", "    sync::atomic::{AtomicU64, Ordering},", "    thread,", "    time::Duration,", "};", "", "const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;", "", "lazy_static! {", "    // this regex is used to remove some additional fields that we get from some servers, namely:", "    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.", "    static ref RE_REMOVE_EXTRA_FIELDS: Regex =", "        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();", "}", "", "#[derive(Serialize)]", "pub struct RpcClient {", "    language_id: LanguageId,", "    #[serde(skip_serializing)]", "    id: AtomicU64,", "    #[serde(skip_serializing)]", "    writer_tx: Sender<RawMessage>,", "    #[serde(skip_serializing)]", "    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,", "    pub process_id: Option<u32>,", "}", "", "impl RpcClient {", "    #[allow(clippy::new_ret_no_self)]", "    pub fn new(", "        language_id: LanguageId,", "        reader: impl BufRead + Send + 'static,", "        writer: impl Write + Send + 'static,", "        process_id: Option<u32>,", "        sink: Sender<Call>,", "        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,", "    ) -> Result<Self> {", "        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();", "", "        let language_id_clone = language_id.clone();", "        let reader_thread_name = format!(\"reader-{:?}\", language_id);", "        let on_crash_clone = on_crash.clone();", "        thread::Builder::new()", "            .name(reader_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {", "                            on_crash_clone(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);", "                }", "            })?;", "", "        let (writer_tx, writer_rx) = unbounded();", "        let writer_thread_name = format!(\"writer-{:?}\", language_id);", "        let language_id_clone = language_id.clone();", "        thread::Builder::new()", "            .name(writer_thread_name.clone())", "            .spawn(move || {", "                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {", "                    match err.downcast_ref::<std::io::Error>() {", "                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {", "                            on_crash(&language_id_clone)", "                        }", "                        _ => {}", "                    }", "", "                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);", "                }", "            })?;", "", "        Ok(Self {", "            language_id,", "            id: AtomicU64::default(),", "            process_id,", "            reader_tx,", "            writer_tx,", "        })", "    }", "", "    pub fn call<R: DeserializeOwned>(", "        &self,", "        method: impl AsRef<str>,", "        params: impl Serialize,", "    ) -> Result<R> {", "        let method = method.as_ref();", "        let id = self.id.fetch_add(1, Ordering::SeqCst);", "        let msg = jsonrpc_core::MethodCall {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            id: jsonrpc_core::Id::Num(id),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        let (tx, rx) = bounded(1);", "        self.reader_tx.send((id, tx))?;", "        self.writer_tx.send(RawMessage::MethodCall(msg))?;", "        // TODO: duration from config.", "        match rx.recv_timeout(Duration::from_secs(60))? {", "            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),", "            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,", "            // which we don't want to show to the user and should ignore, as the result of the", "            // request that triggered this error has been invalidated by changes to the state", "            // of the server, so we must handle this error specifically.", "            jsonrpc_core::Output::Failure(err)", "                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>", "            {", "                Err(anyhow::Error::from(LSError::ContentModified))", "            }", "            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),", "        }", "    }", "", "    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {", "        let method = method.as_ref();", "", "        let msg = jsonrpc_core::Notification {", "            jsonrpc: Some(jsonrpc_core::Version::V2),", "            method: method.to_owned(),", "            params: params.to_params()?,", "        };", "        self.writer_tx.send(RawMessage::Notification(msg))?;", "        Ok(())", "    }", "", "    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {", "        let output = match result {", "            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                result: serde_json::to_value(ok)?,", "            }),", "            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {", "                jsonrpc: Some(jsonrpc_core::Version::V2),", "                id: jsonrpc_core::Id::Num(id),", "                error: err.to_rpc_error(),", "            }),", "        };", "", "        self.writer_tx.send(RawMessage::Output(output))?;", "        Ok(())", "    }", "}", "", "fn loop_read(", "    reader: impl BufRead,", "    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,", "    sink: &Sender<Call>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut pending_outputs = HashMap::new();", "", "    // Count how many consequent empty lines.", "    let mut count_empty_lines = 0;", "", "    let mut reader = reader;", "    let mut content_length = 0;", "    loop {", "        let mut message = String::new();", "        let mut line = String::new();", "        if language_id.is_some() {", "            reader.read_line(&mut line)?;", "            let line = line.trim();", "            if line.is_empty() {", "                count_empty_lines += 1;", "                if count_empty_lines > 5 {", "                    return Err(anyhow!(\"Unable to read from language server\"));", "                }", "", "                let mut buf = vec![0; content_length];", "                reader.read_exact(buf.as_mut_slice())?;", "                message = String::from_utf8(buf)?;", "            } else {", "                count_empty_lines = 0;", "                if !line.starts_with(\"Content-Length\") {", "                    continue;", "                }", "", "                let tokens: Vec<&str> = line.splitn(2, ':').collect();", "                let len = tokens", "                    .get(1)", "                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?", "                    .trim();", "                content_length = usize::from_str(len)?;", "            }", "        } else if reader.read_line(&mut message)? == 0 {", "            break;", "        }", "", "        let message = message.trim();", "        if message.is_empty() {", "            continue;", "        }", "        debug!(\"<= {:?} {}\", language_id, message);", "        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and", "        // `requestMethod` sent by Sorbet.", "        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let message = serde_json::from_str(&s);", "        if let Err(ref err) = message {", "            error!(", "                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",", "                err, s, err", "            );", "            continue;", "        }", "        // TODO: cleanup.", "        let message = message.unwrap();", "        match message {", "            RawMessage::MethodCall(method_call) => {", "                sink.send(Call::MethodCall(language_id.clone(), method_call))?;", "            }", "            RawMessage::Notification(notification) => {", "                sink.send(Call::Notification(language_id.clone(), notification))?;", "            }", "            RawMessage::Output(output) => {", "                while let Ok((id, tx)) = reader_rx.try_recv() {", "                    pending_outputs.insert(id, tx);", "                }", "", "                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {", "                    tx.send(output)", "                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;", "                }", "            }", "        };", "    }", "", "    info!(\"reader-{:?} terminated\", language_id);", "    Ok(())", "}", "", "fn loop_write(", "    writer: impl Write,", "    rx: &Receiver<RawMessage>,", "    language_id: &LanguageId,", ") -> Result<()> {", "    let mut writer = writer;", "", "    for msg in rx.iter() {", "        let s = serde_json::to_string(&msg)?;", "        debug!(\"=> {:?} {}\", language_id, s);", "        if language_id.is_none() {", "            // Use different convention for two reasons,", "            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim", "            // receives `content`.", "            // 2. Without last line ending, vim output handler won't be triggered.", "            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;", "        } else {", "            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;", "        };", "        writer.flush()?;", "    }", "    Ok(())", "}", "", "#[cfg(test)]", "mod test {", "    use super::RE_REMOVE_EXTRA_FIELDS;", "    use crate::types::RawMessage;", "", "    #[test]", "    // The library we're using for json-rpc doesn't accept extra fields in the structs used to", "    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so", "    // the client fails to deserialize that response.", "    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is", "    // suboptimal, so we now try to remove the extra fields we know of from the response.", "    //", "    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892", "    fn it_should_remove_extra_fields() {", "        // it removes the requestMethod field from Sorbet", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        let message =", "            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "", "        // it removes the meta field from javascript-typescript-langserver", "        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;", "        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");", "        let result: Result<RawMessage, _> = serde_json::from_str(&message);", "        assert!(result.is_ok());", "    }", "}", ""]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["LSP#position()"],"id":26}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 26, "jsonrpc": "2.0", "result": {"character": 45, "line": 49}}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["expand('<cword>')"],"id":27}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 27, "jsonrpc": "2.0", "result": "clone"}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/definition","params":{"bufnr":1,"character":45,"filename":"/home/dick/LanguageClient-neovim/src/rpcclient.rs","gotoCmd":null,"handle":true,"languageId":"rust","line":49,"method":"textDocument/definition","position":{"character":45,"line":49},"text":["use crate::types::{Call, Id, LSError, LanguageId, RawMessage, ToInt, ToParams, ToRpcError};","use anyhow::{anyhow, Result};","use crossbeam::channel::{bounded, unbounded, Receiver, Sender};","use log::*;","use regex::Regex;","use serde::{de::DeserializeOwned, Serialize};","use std::io::Write;","use std::str::FromStr;","use std::{","    collections::HashMap,","    io::BufRead,","    sync::atomic::{AtomicU64, Ordering},","    thread,","    time::Duration,","};","","const CONTENT_MODIFIED_ERROR_CODE: i64 = -32801;","","lazy_static! {","    // this regex is used to remove some additional fields that we get from some servers, namely:","    // meta, sent by javascript-typescript-langserver and requestMethod, sent by Sorbet.","    static ref RE_REMOVE_EXTRA_FIELDS: Regex =","        Regex::new(r#\",\\s?\"(?:meta|requestMethod)\":(?:\"\\w+(/\\w+)?\"|\\{\\})\"#).unwrap();","}","","#[derive(Serialize)]","pub struct RpcClient {","    language_id: LanguageId,","    #[serde(skip_serializing)]","    id: AtomicU64,","    #[serde(skip_serializing)]","    writer_tx: Sender<RawMessage>,","    #[serde(skip_serializing)]","    reader_tx: Sender<(Id, Sender<jsonrpc_core::Output>)>,","    pub process_id: Option<u32>,","}","","impl RpcClient {","    #[allow(clippy::new_ret_no_self)]","    pub fn new(","        language_id: LanguageId,","        reader: impl BufRead + Send + 'static,","        writer: impl Write + Send + 'static,","        process_id: Option<u32>,","        sink: Sender<Call>,","        on_crash: impl Fn(&LanguageId) + Clone + Send + 'static,","    ) -> Result<Self> {","        let (reader_tx, reader_rx): (Sender<(Id, Sender<jsonrpc_core::Output>)>, _) = unbounded();","","        let language_id_clone = language_id.clone();","        let reader_thread_name = format!(\"reader-{:?}\", language_id);","        let on_crash_clone = on_crash.clone();","        thread::Builder::new()","            .name(reader_thread_name.clone())","            .spawn(move || {","                if let Err(err) = loop_read(reader, reader_rx, &sink, &language_id_clone) {","                    match err.downcast_ref::<std::io::Error>() {","                        Some(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {","                            on_crash_clone(&language_id_clone)","                        }","                        _ => {}","                    }","","                    error!(\"Thread {} exited with error: {:?}\", reader_thread_name, err);","                }","            })?;","","        let (writer_tx, writer_rx) = unbounded();","        let writer_thread_name = format!(\"writer-{:?}\", language_id);","        let language_id_clone = language_id.clone();","        thread::Builder::new()","            .name(writer_thread_name.clone())","            .spawn(move || {","                if let Err(err) = loop_write(writer, &writer_rx, &language_id_clone) {","                    match err.downcast_ref::<std::io::Error>() {","                        Some(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {","                            on_crash(&language_id_clone)","                        }","                        _ => {}","                    }","","                    error!(\"Thread {} exited with error: {:?}\", writer_thread_name, err);","                }","            })?;","","        Ok(Self {","            language_id,","            id: AtomicU64::default(),","            process_id,","            reader_tx,","            writer_tx,","        })","    }","","    pub fn call<R: DeserializeOwned>(","        &self,","        method: impl AsRef<str>,","        params: impl Serialize,","    ) -> Result<R> {","        let method = method.as_ref();","        let id = self.id.fetch_add(1, Ordering::SeqCst);","        let msg = jsonrpc_core::MethodCall {","            jsonrpc: Some(jsonrpc_core::Version::V2),","            id: jsonrpc_core::Id::Num(id),","            method: method.to_owned(),","            params: params.to_params()?,","        };","        let (tx, rx) = bounded(1);","        self.reader_tx.send((id, tx))?;","        self.writer_tx.send(RawMessage::MethodCall(msg))?;","        // TODO: duration from config.","        match rx.recv_timeout(Duration::from_secs(60))? {","            jsonrpc_core::Output::Success(ok) => Ok(serde_json::from_value(ok.result)?),","            // NOTE: Errors with code -32801 correspond to the protocol's ContentModified error,","            // which we don't want to show to the user and should ignore, as the result of the","            // request that triggered this error has been invalidated by changes to the state","            // of the server, so we must handle this error specifically.","            jsonrpc_core::Output::Failure(err)","                if err.error.code.code() == CONTENT_MODIFIED_ERROR_CODE =>","            {","                Err(anyhow::Error::from(LSError::ContentModified))","            }","            jsonrpc_core::Output::Failure(err) => Err(anyhow!(\"Error: {:?}\", err)),","        }","    }","","    pub fn notify(&self, method: impl AsRef<str>, params: impl Serialize) -> Result<()> {","        let method = method.as_ref();","","        let msg = jsonrpc_core::Notification {","            jsonrpc: Some(jsonrpc_core::Version::V2),","            method: method.to_owned(),","            params: params.to_params()?,","        };","        self.writer_tx.send(RawMessage::Notification(msg))?;","        Ok(())","    }","","    pub fn output(&self, id: Id, result: Result<impl Serialize>) -> Result<()> {","        let output = match result {","            Ok(ok) => jsonrpc_core::Output::Success(jsonrpc_core::Success {","                jsonrpc: Some(jsonrpc_core::Version::V2),","                id: jsonrpc_core::Id::Num(id),","                result: serde_json::to_value(ok)?,","            }),","            Err(err) => jsonrpc_core::Output::Failure(jsonrpc_core::Failure {","                jsonrpc: Some(jsonrpc_core::Version::V2),","                id: jsonrpc_core::Id::Num(id),","                error: err.to_rpc_error(),","            }),","        };","","        self.writer_tx.send(RawMessage::Output(output))?;","        Ok(())","    }","}","","fn loop_read(","    reader: impl BufRead,","    reader_rx: Receiver<(Id, Sender<jsonrpc_core::Output>)>,","    sink: &Sender<Call>,","    language_id: &LanguageId,",") -> Result<()> {","    let mut pending_outputs = HashMap::new();","","    // Count how many consequent empty lines.","    let mut count_empty_lines = 0;","","    let mut reader = reader;","    let mut content_length = 0;","    loop {","        let mut message = String::new();","        let mut line = String::new();","        if language_id.is_some() {","            reader.read_line(&mut line)?;","            let line = line.trim();","            if line.is_empty() {","                count_empty_lines += 1;","                if count_empty_lines > 5 {","                    return Err(anyhow!(\"Unable to read from language server\"));","                }","","                let mut buf = vec![0; content_length];","                reader.read_exact(buf.as_mut_slice())?;","                message = String::from_utf8(buf)?;","            } else {","                count_empty_lines = 0;","                if !line.starts_with(\"Content-Length\") {","                    continue;","                }","","                let tokens: Vec<&str> = line.splitn(2, ':').collect();","                let len = tokens","                    .get(1)","                    .ok_or_else(|| anyhow!(\"Failed to get length! tokens: {:?}\", tokens))?","                    .trim();","                content_length = usize::from_str(len)?;","            }","        } else if reader.read_line(&mut message)? == 0 {","            break;","        }","","        let message = message.trim();","        if message.is_empty() {","            continue;","        }","        debug!(\"<= {:?} {}\", language_id, message);","        // FIXME: Remove extra `meta` property from javascript-typescript-langserver and","        // `requestMethod` sent by Sorbet.","        let s = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let message = serde_json::from_str(&s);","        if let Err(ref err) = message {","            error!(","                \"Failed to deserialize output: {}\\n\\n Message: {}\\n\\nError: {:?}\",","                err, s, err","            );","            continue;","        }","        // TODO: cleanup.","        let message = message.unwrap();","        match message {","            RawMessage::MethodCall(method_call) => {","                sink.send(Call::MethodCall(language_id.clone(), method_call))?;","            }","            RawMessage::Notification(notification) => {","                sink.send(Call::Notification(language_id.clone(), notification))?;","            }","            RawMessage::Output(output) => {","                while let Ok((id, tx)) = reader_rx.try_recv() {","                    pending_outputs.insert(id, tx);","                }","","                if let Some(tx) = pending_outputs.remove(&output.id().to_int()?) {","                    tx.send(output)","                        .map_err(|output| anyhow!(\"Failed to send output: {:?}\", output))?;","                }","            }","        };","    }","","    info!(\"reader-{:?} terminated\", language_id);","    Ok(())","}","","fn loop_write(","    writer: impl Write,","    rx: &Receiver<RawMessage>,","    language_id: &LanguageId,",") -> Result<()> {","    let mut writer = writer;","","    for msg in rx.iter() {","        let s = serde_json::to_string(&msg)?;","        debug!(\"=> {:?} {}\", language_id, s);","        if language_id.is_none() {","            // Use different convention for two reasons,","            // 1. If using '\\r\\ncontent', nvim will receive output as `\\r` + `content`, while vim","            // receives `content`.","            // 2. Without last line ending, vim output handler won't be triggered.","            write!(writer, \"Content-Length: {}\\n\\n{}\\n\", s.len(), s)?;","        } else {","            write!(writer, \"Content-Length: {}\\r\\n\\r\\n{}\", s.len(), s)?;","        };","        writer.flush()?;","    }","    Ok(())","}","","#[cfg(test)]","mod test {","    use super::RE_REMOVE_EXTRA_FIELDS;","    use crate::types::RawMessage;","","    #[test]","    // The library we're using for json-rpc doesn't accept extra fields in the structs used to","    // deserialize the message. Sorbet (and possibly other servers) sends an extra field in it, so","    // the client fails to deserialize that response.","    // Our previous solution was to pin the dependency to jsonrpc-core to version 12, but is","    // suboptimal, so we now try to remove the extra fields we know of from the response.","    //","    // See related issue: https://github.com/autozimu/LanguageClient-neovim/issues/892","    fn it_should_remove_extra_fields() {","        // it removes the requestMethod field from Sorbet","        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"initialize\",\"result\":0}\"#;","        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let result: Result<RawMessage, _> = serde_json::from_str(&message);","        assert!(result.is_ok());","","        let message =","            r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"requestMethod\":\"textDocument/definition\",\"result\":0}\"#;","        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let result: Result<RawMessage, _> = serde_json::from_str(&message);","        assert!(result.is_ok());","","        // it removes the meta field from javascript-typescript-langserver","        let message = r#\"{\"jsonrpc\":\"2.0\",\"id\":1,\"meta\":{},\"result\":0}\"#;","        let message = RE_REMOVE_EXTRA_FIELDS.replace(message, \"\");","        let result: Result<RawMessage, _> = serde_json::from_str(&message);","        assert!(result.is_ok());","    }","}",""],"textDocument":{"uri":"file:///home/dick/LanguageClient-neovim/src/rpcclient.rs"}},"id":2}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":2,"result":[{"originSelectionRange":{"start":{"line":49,"character":44},"end":{"line":49,"character":49}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1886,"character":4},"end":{"line":1892,"character":5}},"targetSelectionRange":{"start":{"line":1887,"character":7},"end":{"line":1887,"character":12}}}]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:Edit","params":["edit","/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"cursor","params":[1888,8]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["expand('%')"],"id":28}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleFileType", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 22, "start": 0}, "languageId": "rust", "position": {"character": 0, "line": 0}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:2760 handle_file_type; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})})
17:00:16 INFO unnamed src/language_server_protocol.rs:1946 text_document_did_open; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"LSP#text","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"],"id":29}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleBufEnter", "jsonrpc": "2.0", "params": {"bufnr": 2, "languageId": "rust", "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:2739 handle_buf_enter; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust")})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","LanguageClient_isServerRunning",1]}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 28, "jsonrpc": "2.0", "result": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:EchomsgEllipsis","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs 1888:8"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","result":[{"originSelectionRange":{"end":{"character":49,"line":49},"start":{"character":44,"line":49}},"targetRange":{"end":{"character":5,"line":1892},"start":{"character":4,"line":1886}},"targetSelectionRange":{"end":{"character":12,"line":1887},"start":{"character":7,"line":1887}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}],"id":1}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 29, "jsonrpc": "2.0", "result": ["//! Optional values.", "//!", "//! Type [`Option`] represents an optional value: every [`Option`]", "//! is either [`Some`] and contains a value, or [`None`], and", "//! does not. [`Option`] types are very common in Rust code, as", "//! they have a number of uses:", "//!", "//! * Initial values", "//! * Return values for functions that are not defined", "//!   over their entire input range (partial functions)", "//! * Return value for otherwise reporting simple errors, where [`None`] is", "//!   returned on error", "//! * Optional struct fields", "//! * Struct fields that can be loaned or \"taken\"", "//! * Optional function arguments", "//! * Nullable pointers", "//! * Swapping things out of difficult situations", "//!", "//! [`Option`]s are commonly paired with pattern matching to query the presence", "//! of a value and take action, always accounting for the [`None`] case.", "//!", "//! ```", "//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {", "//!     if denominator == 0.0 {", "//!         None", "//!     } else {", "//!         Some(numerator / denominator)", "//!     }", "//! }", "//!", "//! // The return value of the function is an option", "//! let result = divide(2.0, 3.0);", "//!", "//! // Pattern match to retrieve the value", "//! match result {", "//!     // The division was valid", "//!     Some(x) => println!(\"Result: {x}\"),", "//!     // The division was invalid", "//!     None    => println!(\"Cannot divide by 0\"),", "//! }", "//! ```", "//!", "//", "// FIXME: Show how `Option` is used in practice, with lots of methods", "//", "//! # Options and pointers (\"nullable\" pointers)", "//!", "//! Rust's pointer types must always point to a valid location; there are", "//! no \"null\" references. Instead, Rust has *optional* pointers, like", "//! the optional owned box, <code>[Option]<[Box\\<T>]></code>.", "//!", "//! [Box\\<T>]: ../../std/boxed/struct.Box.html", "//!", "//! The following example uses [`Option`] to create an optional box of", "//! [`i32`]. Notice that in order to use the inner [`i32`] value, the", "//! `check_optional` function first needs to use pattern matching to", "//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or", "//! not ([`None`]).", "//!", "//! ```", "//! let optional = None;", "//! check_optional(optional);", "//!", "//! let optional = Some(Box::new(9000));", "//! check_optional(optional);", "//!", "//! fn check_optional(optional: Option<Box<i32>>) {", "//!     match optional {", "//!         Some(p) => println!(\"has value {p}\"),", "//!         None => println!(\"has no value\"),", "//!     }", "//! }", "//! ```", "//!", "//! # Representation", "//!", "//! Rust guarantees to optimize the following types `T` such that", "//! [`Option<T>`] has the same size as `T`:", "//!", "//! * [`Box<U>`]", "//! * `&U`", "//! * `&mut U`", "//! * `fn`, `extern \"C\" fn`[^extern_fn]", "//! * [`num::NonZero*`]", "//! * [`ptr::NonNull<U>`]", "//! * `#[repr(transparent)]` struct around one of the types in this list.", "//!", "//! [^extern_fn]: this remains true for any other ABI: `extern \"abi\" fn` (_e.g._, `extern \"system\" fn`)", "//!", "//! [`Box<U>`]: ../../std/boxed/struct.Box.html", "//! [`num::NonZero*`]: crate::num", "//! [`ptr::NonNull<U>`]: crate::ptr::NonNull", "//!", "//! This is called the \"null pointer optimization\" or NPO.", "//!", "//! It is further guaranteed that, for the cases above, one can", "//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and", "//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`", "//! is undefined behaviour).", "//!", "//! # Method overview", "//!", "//! In addition to working with pattern matching, [`Option`] provides a wide", "//! variety of different methods.", "//!", "//! ## Querying the variant", "//!", "//! The [`is_some`] and [`is_none`] methods return [`true`] if the [`Option`]", "//! is [`Some`] or [`None`], respectively.", "//!", "//! [`is_none`]: Option::is_none", "//! [`is_some`]: Option::is_some", "//!", "//! ## Adapters for working with references", "//!", "//! * [`as_ref`] converts from <code>[&][][Option]\\<T></code> to <code>[Option]<[&]T></code>", "//! * [`as_mut`] converts from <code>[&mut] [Option]\\<T></code> to <code>[Option]<[&mut] T></code>", "//! * [`as_deref`] converts from <code>[&][][Option]\\<T></code> to", "//!   <code>[Option]<[&]T::[Target]></code>", "//! * [`as_deref_mut`] converts from <code>[&mut] [Option]\\<T></code> to", "//!   <code>[Option]<[&mut] T::[Target]></code>", "//! * [`as_pin_ref`] converts from <code>[Pin]<[&][][Option]\\<T>></code> to", "//!   <code>[Option]<[Pin]<[&]T>></code>", "//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\\<T>></code> to", "//!   <code>[Option]<[Pin]<[&mut] T>></code>", "//!", "//! [&]: reference \"shared reference\"", "//! [&mut]: reference \"mutable reference\"", "//! [Target]: Deref::Target \"ops::Deref::Target\"", "//! [`as_deref`]: Option::as_deref", "//! [`as_deref_mut`]: Option::as_deref_mut", "//! [`as_mut`]: Option::as_mut", "//! [`as_pin_mut`]: Option::as_pin_mut", "//! [`as_pin_ref`]: Option::as_pin_ref", "//! [`as_ref`]: Option::as_ref", "//!", "//! ## Extracting the contained value", "//!", "//! These methods extract the contained value in an [`Option<T>`] when it", "//! is the [`Some`] variant. If the [`Option`] is [`None`]:", "//!", "//! * [`expect`] panics with a provided custom message", "//! * [`unwrap`] panics with a generic message", "//! * [`unwrap_or`] returns the provided default value", "//! * [`unwrap_or_default`] returns the default value of the type `T`", "//!   (which must implement the [`Default`] trait)", "//! * [`unwrap_or_else`] returns the result of evaluating the provided", "//!   function", "//!", "//! [`expect`]: Option::expect", "//! [`unwrap`]: Option::unwrap", "//! [`unwrap_or`]: Option::unwrap_or", "//! [`unwrap_or_default`]: Option::unwrap_or_default", "//! [`unwrap_or_else`]: Option::unwrap_or_else", "//!", "//! ## Transforming contained values", "//!", "//! These methods transform [`Option`] to [`Result`]:", "//!", "//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to", "//!   [`Err(err)`] using the provided default `err` value", "//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to", "//!   a value of [`Err`] using the provided function", "//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a", "//!   [`Result`] of an [`Option`]", "//!", "//! [`Err(err)`]: Err", "//! [`Ok(v)`]: Ok", "//! [`Some(v)`]: Some", "//! [`ok_or`]: Option::ok_or", "//! [`ok_or_else`]: Option::ok_or_else", "//! [`transpose`]: Option::transpose", "//!", "//! These methods transform the [`Some`] variant:", "//!", "//! * [`filter`] calls the provided predicate function on the contained", "//!   value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]", "//!   if the function returns `true`; otherwise, returns [`None`]", "//! * [`flatten`] removes one level of nesting from an", "//!   [`Option<Option<T>>`]", "//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the", "//!   provided function to the contained value of [`Some`] and leaving", "//!   [`None`] values unchanged", "//!", "//! [`Some(t)`]: Some", "//! [`filter`]: Option::filter", "//! [`flatten`]: Option::flatten", "//! [`map`]: Option::map", "//!", "//! These methods transform [`Option<T>`] to a value of a possibly", "//! different type `U`:", "//!", "//! * [`map_or`] applies the provided function to the contained value of", "//!   [`Some`], or returns the provided default value if the [`Option`] is", "//!   [`None`]", "//! * [`map_or_else`] applies the provided function to the contained value", "//!   of [`Some`], or returns the result of evaluating the provided", "//!   fallback function if the [`Option`] is [`None`]", "//!", "//! [`map_or`]: Option::map_or", "//! [`map_or_else`]: Option::map_or_else", "//!", "//! These methods combine the [`Some`] variants of two [`Option`] values:", "//!", "//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the", "//!   provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]", "//! * [`zip_with`] calls the provided function `f` and returns", "//!   [`Some(f(s, o))`] if `self` is [`Some(s)`] and the provided", "//!   [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]", "//!", "//! [`Some(f(s, o))`]: Some", "//! [`Some(o)`]: Some", "//! [`Some(s)`]: Some", "//! [`Some((s, o))`]: Some", "//! [`zip`]: Option::zip", "//! [`zip_with`]: Option::zip_with", "//!", "//! ## Boolean operators", "//!", "//! These methods treat the [`Option`] as a boolean value, where [`Some`]", "//! acts like [`true`] and [`None`] acts like [`false`]. There are two", "//! categories of these methods: ones that take an [`Option`] as input, and", "//! ones that take a function as input (to be lazily evaluated).", "//!", "//! The [`and`], [`or`], and [`xor`] methods take another [`Option`] as", "//! input, and produce an [`Option`] as output. Only the [`and`] method can", "//! produce an [`Option<U>`] value having a different inner type `U` than", "//! [`Option<T>`].", "//!", "//! | method  | self      | input     | output    |", "//! |---------|-----------|-----------|-----------|", "//! | [`and`] | `None`    | (ignored) | `None`    |", "//! | [`and`] | `Some(x)` | `None`    | `None`    |", "//! | [`and`] | `Some(x)` | `Some(y)` | `Some(y)` |", "//! | [`or`]  | `None`    | `None`    | `None`    |", "//! | [`or`]  | `None`    | `Some(y)` | `Some(y)` |", "//! | [`or`]  | `Some(x)` | (ignored) | `Some(x)` |", "//! | [`xor`] | `None`    | `None`    | `None`    |", "//! | [`xor`] | `None`    | `Some(y)` | `Some(y)` |", "//! | [`xor`] | `Some(x)` | `None`    | `Some(x)` |", "//! | [`xor`] | `Some(x)` | `Some(y)` | `None`    |", "//!", "//! [`and`]: Option::and", "//! [`or`]: Option::or", "//! [`xor`]: Option::xor", "//!", "//! The [`and_then`] and [`or_else`] methods take a function as input, and", "//! only evaluate the function when they need to produce a new value. Only", "//! the [`and_then`] method can produce an [`Option<U>`] value having a", "//! different inner type `U` than [`Option<T>`].", "//!", "//! | method       | self      | function input | function result | output    |", "//! |--------------|-----------|----------------|-----------------|-----------|", "//! | [`and_then`] | `None`    | (not provided) | (not evaluated) | `None`    |", "//! | [`and_then`] | `Some(x)` | `x`            | `None`          | `None`    |", "//! | [`and_then`] | `Some(x)` | `x`            | `Some(y)`       | `Some(y)` |", "//! | [`or_else`]  | `None`    | (not provided) | `None`          | `None`    |", "//! | [`or_else`]  | `None`    | (not provided) | `Some(y)`       | `Some(y)` |", "//! | [`or_else`]  | `Some(x)` | (not provided) | (not evaluated) | `Some(x)` |", "//!", "//! [`and_then`]: Option::and_then", "//! [`or_else`]: Option::or_else", "//!", "//! This is an example of using methods like [`and_then`] and [`or`] in a", "//! pipeline of method calls. Early stages of the pipeline pass failure", "//! values ([`None`]) through unchanged, and continue processing on", "//! success values ([`Some`]). Toward the end, [`or`] substitutes an error", "//! message if it receives [`None`].", "//!", "//! ```", "//! # use std::collections::BTreeMap;", "//! let mut bt = BTreeMap::new();", "//! bt.insert(20u8, \"foo\");", "//! bt.insert(42u8, \"bar\");", "//! let res = [0u8, 1, 11, 200, 22]", "//!     .into_iter()", "//!     .map(|x| {", "//!         // `checked_sub()` returns `None` on error", "//!         x.checked_sub(1)", "//!             // same with `checked_mul()`", "//!             .and_then(|x| x.checked_mul(2))", "//!             // `BTreeMap::get` returns `None` on error", "//!             .and_then(|x| bt.get(&x))", "//!             // Substitute an error message if we have `None` so far", "//!             .or(Some(&\"error!\"))", "//!             .copied()", "//!             // Won't panic because we unconditionally used `Some` above", "//!             .unwrap()", "//!     })", "//!     .collect::<Vec<_>>();", "//! assert_eq!(res, [\"error!\", \"error!\", \"foo\", \"error!\", \"bar\"]);", "//! ```", "//!", "//! ## Comparison operators", "//!", "//! If `T` implements [`PartialOrd`] then [`Option<T>`] will derive its", "//! [`PartialOrd`] implementation.  With this order, [`None`] compares as", "//! less than any [`Some`], and two [`Some`] compare the same way as their", "//! contained values would in `T`.  If `T` also implements", "//! [`Ord`], then so does [`Option<T>`].", "//!", "//! ```", "//! assert!(None < Some(0));", "//! assert!(Some(0) < Some(1));", "//! ```", "//!", "//! ## Iterating over `Option`", "//!", "//! An [`Option`] can be iterated over. This can be helpful if you need an", "//! iterator that is conditionally empty. The iterator will either produce", "//! a single value (when the [`Option`] is [`Some`]), or produce no values", "//! (when the [`Option`] is [`None`]). For example, [`into_iter`] acts like", "//! [`once(v)`] if the [`Option`] is [`Some(v)`], and like [`empty()`] if", "//! the [`Option`] is [`None`].", "//!", "//! [`Some(v)`]: Some", "//! [`empty()`]: crate::iter::empty", "//! [`once(v)`]: crate::iter::once", "//!", "//! Iterators over [`Option<T>`] come in three types:", "//!", "//! * [`into_iter`] consumes the [`Option`] and produces the contained", "//!   value", "//! * [`iter`] produces an immutable reference of type `&T` to the", "//!   contained value", "//! * [`iter_mut`] produces a mutable reference of type `&mut T` to the", "//!   contained value", "//!", "//! [`into_iter`]: Option::into_iter", "//! [`iter`]: Option::iter", "//! [`iter_mut`]: Option::iter_mut", "//!", "//! An iterator over [`Option`] can be useful when chaining iterators, for", "//! example, to conditionally insert items. (It's not always necessary to", "//! explicitly call an iterator constructor: many [`Iterator`] methods that", "//! accept other iterators will also accept iterable types that implement", "//! [`IntoIterator`], which includes [`Option`].)", "//!", "//! ```", "//! let yep = Some(42);", "//! let nope = None;", "//! // chain() already calls into_iter(), so we don't have to do so", "//! let nums: Vec<i32> = (0..4).chain(yep).chain(4..8).collect();", "//! assert_eq!(nums, [0, 1, 2, 3, 42, 4, 5, 6, 7]);", "//! let nums: Vec<i32> = (0..4).chain(nope).chain(4..8).collect();", "//! assert_eq!(nums, [0, 1, 2, 3, 4, 5, 6, 7]);", "//! ```", "//!", "//! One reason to chain iterators in this way is that a function returning", "//! `impl Iterator` must have all possible return values be of the same", "//! concrete type. Chaining an iterated [`Option`] can help with that.", "//!", "//! ```", "//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {", "//!     // Explicit returns to illustrate return types matching", "//!     match do_insert {", "//!         true => return (0..4).chain(Some(42)).chain(4..8),", "//!         false => return (0..4).chain(None).chain(4..8),", "//!     }", "//! }", "//! println!(\"{:?}\", make_iter(true).collect::<Vec<_>>());", "//! println!(\"{:?}\", make_iter(false).collect::<Vec<_>>());", "//! ```", "//!", "//! If we try to do the same thing, but using [`once()`] and [`empty()`],", "//! we can't return `impl Iterator` anymore because the concrete types of", "//! the return values differ.", "//!", "//! [`empty()`]: crate::iter::empty", "//! [`once()`]: crate::iter::once", "//!", "//! ```compile_fail,E0308", "//! # use std::iter::{empty, once};", "//! // This won't compile because all possible returns from the function", "//! // must have the same concrete type.", "//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {", "//!     // Explicit returns to illustrate return types not matching", "//!     match do_insert {", "//!         true => return (0..4).chain(once(42)).chain(4..8),", "//!         false => return (0..4).chain(empty()).chain(4..8),", "//!     }", "//! }", "//! ```", "//!", "//! ## Collecting into `Option`", "//!", "//! [`Option`] implements the [`FromIterator`][impl-FromIterator] trait,", "//! which allows an iterator over [`Option`] values to be collected into an", "//! [`Option`] of a collection of each contained value of the original", "//! [`Option`] values, or [`None`] if any of the elements was [`None`].", "//!", "//! [impl-FromIterator]: Option#impl-FromIterator%3COption%3CA%3E%3E", "//!", "//! ```", "//! let v = [Some(2), Some(4), None, Some(8)];", "//! let res: Option<Vec<_>> = v.into_iter().collect();", "//! assert_eq!(res, None);", "//! let v = [Some(2), Some(4), Some(8)];", "//! let res: Option<Vec<_>> = v.into_iter().collect();", "//! assert_eq!(res, Some(vec![2, 4, 8]));", "//! ```", "//!", "//! [`Option`] also implements the [`Product`][impl-Product] and", "//! [`Sum`][impl-Sum] traits, allowing an iterator over [`Option`] values", "//! to provide the [`product`][Iterator::product] and", "//! [`sum`][Iterator::sum] methods.", "//!", "//! [impl-Product]: Option#impl-Product%3COption%3CU%3E%3E", "//! [impl-Sum]: Option#impl-Sum%3COption%3CU%3E%3E", "//!", "//! ```", "//! let v = [None, Some(1), Some(2), Some(3)];", "//! let res: Option<i32> = v.into_iter().sum();", "//! assert_eq!(res, None);", "//! let v = [Some(1), Some(2), Some(21)];", "//! let res: Option<i32> = v.into_iter().product();", "//! assert_eq!(res, Some(42));", "//! ```", "//!", "//! ## Modifying an [`Option`] in-place", "//!", "//! These methods return a mutable reference to the contained value of an", "//! [`Option<T>`]:", "//!", "//! * [`insert`] inserts a value, dropping any old contents", "//! * [`get_or_insert`] gets the current value, inserting a provided", "//!   default value if it is [`None`]", "//! * [`get_or_insert_default`] gets the current value, inserting the", "//!   default value of type `T` (which must implement [`Default`]) if it is", "//!   [`None`]", "//! * [`get_or_insert_with`] gets the current value, inserting a default", "//!   computed by the provided function if it is [`None`]", "//!", "//! [`get_or_insert`]: Option::get_or_insert", "//! [`get_or_insert_default`]: Option::get_or_insert_default", "//! [`get_or_insert_with`]: Option::get_or_insert_with", "//! [`insert`]: Option::insert", "//!", "//! These methods transfer ownership of the contained value of an", "//! [`Option`]:", "//!", "//! * [`take`] takes ownership of the contained value of an [`Option`], if", "//!   any, replacing the [`Option`] with [`None`]", "//! * [`replace`] takes ownership of the contained value of an [`Option`],", "//!   if any, replacing the [`Option`] with a [`Some`] containing the", "//!   provided value", "//!", "//! [`replace`]: Option::replace", "//! [`take`]: Option::take", "//!", "//! # Examples", "//!", "//! Basic pattern matching on [`Option`]:", "//!", "//! ```", "//! let msg = Some(\"howdy\");", "//!", "//! // Take a reference to the contained string", "//! if let Some(m) = &msg {", "//!     println!(\"{}\", *m);", "//! }", "//!", "//! // Remove the contained string, destroying the Option", "//! let unwrapped_msg = msg.unwrap_or(\"default message\");", "//! ```", "//!", "//! Initialize a result to [`None`] before a loop:", "//!", "//! ```", "//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }", "//!", "//! // A list of data to search through.", "//! let all_the_big_things = [", "//!     Kingdom::Plant(250, \"redwood\"),", "//!     Kingdom::Plant(230, \"noble fir\"),", "//!     Kingdom::Plant(229, \"sugar pine\"),", "//!     Kingdom::Animal(25, \"blue whale\"),", "//!     Kingdom::Animal(19, \"fin whale\"),", "//!     Kingdom::Animal(15, \"north pacific right whale\"),", "//! ];", "//!", "//! // We're going to search for the name of the biggest animal,", "//! // but to start with we've just got `None`.", "//! let mut name_of_biggest_animal = None;", "//! let mut size_of_biggest_animal = 0;", "//! for big_thing in &all_the_big_things {", "//!     match *big_thing {", "//!         Kingdom::Animal(size, name) if size > size_of_biggest_animal => {", "//!             // Now we've found the name of some big animal", "//!             size_of_biggest_animal = size;", "//!             name_of_biggest_animal = Some(name);", "//!         }", "//!         Kingdom::Animal(..) | Kingdom::Plant(..) => ()", "//!     }", "//! }", "//!", "//! match name_of_biggest_animal {", "//!     Some(name) => println!(\"the biggest animal is {name}\"),", "//!     None => println!(\"there are no animals :(\"),", "//! }", "//! ```", "", "#![stable(feature = \"rust1\", since = \"1.0.0\")]", "", "use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};", "use crate::marker::Destruct;", "use crate::panicking::{panic, panic_str};", "use crate::pin::Pin;", "use crate::{", "    convert, hint, mem,", "    ops::{self, ControlFlow, Deref, DerefMut},", "};", "", "/// The `Option` type. See [the module level documentation](self) for more.", "#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]", "#[rustc_diagnostic_item = \"Option\"]", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "pub enum Option<T> {", "    /// No value.", "    #[lang = \"None\"]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    None,", "    /// Some value of type `T`.", "    #[lang = \"Some\"]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    Some(#[stable(feature = \"rust1\", since = \"1.0.0\")] T),", "}", "", "/////////////////////////////////////////////////////////////////////////////", "// Type implementation", "/////////////////////////////////////////////////////////////////////////////", "", "impl<T> Option<T> {", "    /////////////////////////////////////////////////////////////////////////", "    // Querying the contained values", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns `true` if the option is a [`Some`] value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.is_some(), true);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.is_some(), false);", "    /// ```", "    #[must_use = \"if you intended to assert that this has a value, consider `.unwrap()` instead\"]", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]", "    pub const fn is_some(&self) -> bool {", "        matches!(*self, Some(_))", "    }", "", "    /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(is_some_with)]", "    ///", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.is_some_and(|&x| x > 1), true);", "    ///", "    /// let x: Option<u32> = Some(0);", "    /// assert_eq!(x.is_some_and(|&x| x > 1), false);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.is_some_and(|&x| x > 1), false);", "    /// ```", "    #[must_use]", "    #[inline]", "    #[unstable(feature = \"is_some_with\", issue = \"93050\")]", "    pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool {", "        matches!(self, Some(x) if f(x))", "    }", "", "    /// Returns `true` if the option is a [`None`] value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.is_none(), false);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.is_none(), true);", "    /// ```", "    #[must_use = \"if you intended to assert that this doesn't have a value, consider \\", "                  `.and_then(|_| panic!(\\\"`Option` had a value when expected `None`\\\"))` instead\"]", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]", "    pub const fn is_none(&self) -> bool {", "        !self.is_some()", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Adapter for working with references", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Converts from `&Option<T>` to `Option<&T>`.", "    ///", "    /// # Examples", "    ///", "    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving", "    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,", "    /// so this technique uses `as_ref` to first take an `Option` to a reference", "    /// to the value inside the original.", "    ///", "    /// [`map`]: Option::map", "    /// [String]: ../../std/string/struct.String.html \"String\"", "    ///", "    /// ```", "    /// let text: Option<String> = Some(\"Hello, world!\".to_string());", "    /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,", "    /// // then consume *that* with `map`, leaving `text` on the stack.", "    /// let text_length: Option<usize> = text.as_ref().map(|s| s.len());", "    /// println!(\"still can print text: {text:?}\");", "    /// ```", "    #[inline]", "    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    pub const fn as_ref(&self) -> Option<&T> {", "        match *self {", "            Some(ref x) => Some(x),", "            None => None,", "        }", "    }", "", "    /// Converts from `&mut Option<T>` to `Option<&mut T>`.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(2);", "    /// match x.as_mut() {", "    ///     Some(v) => *v = 42,", "    ///     None => {},", "    /// }", "    /// assert_eq!(x, Some(42));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn as_mut(&mut self) -> Option<&mut T> {", "        match *self {", "            Some(ref mut x) => Some(x),", "            None => None,", "        }", "    }", "", "    /// Converts from <code>[Pin]<[&]Option\\<T>></code> to <code>Option<[Pin]<[&]T>></code>.", "    ///", "    /// [&]: reference \"shared reference\"", "    #[inline]", "    #[must_use]", "    #[stable(feature = \"pin\", since = \"1.33.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {", "        match Pin::get_ref(self).as_ref() {", "            // SAFETY: `x` is guaranteed to be pinned because it comes from `self`", "            // which is pinned.", "            Some(x) => unsafe { Some(Pin::new_unchecked(x)) },", "            None => None,", "        }", "    }", "", "    /// Converts from <code>[Pin]<[&mut] Option\\<T>></code> to <code>Option<[Pin]<[&mut] T>></code>.", "    ///", "    /// [&mut]: reference \"mutable reference\"", "    #[inline]", "    #[must_use]", "    #[stable(feature = \"pin\", since = \"1.33.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {", "        // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.", "        // `x` is guaranteed to be pinned because it comes from `self` which is pinned.", "        unsafe {", "            match Pin::get_unchecked_mut(self).as_mut() {", "                Some(x) => Some(Pin::new_unchecked(x)),", "                None => None,", "            }", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Getting to contained values", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns the contained [`Some`] value, consuming the `self` value.", "    ///", "    /// # Panics", "    ///", "    /// Panics if the value is a [`None`] with a custom panic message provided by", "    /// `msg`.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"value\");", "    /// assert_eq!(x.expect(\"fruits are healthy\"), \"value\");", "    /// ```", "    ///", "    /// ```should_panic", "    /// let x: Option<&str> = None;", "    /// x.expect(\"fruits are healthy\"); // panics with `fruits are healthy`", "    /// ```", "    ///", "    /// # Recommended Message Style", "    ///", "    /// We recommend that `expect` messages are used to describe the reason you", "    /// _expect_ the `Option` should be `Some`.", "    ///", "    /// ```should_panic", "    /// # let slice: &[u8] = &[];", "    /// let item = slice.get(0)", "    ///     .expect(\"slice should not be empty\");", "    /// ```", "    ///", "    /// **Hint**: If you're having trouble remembering how to phrase expect", "    /// error messages remember to focus on the word \"should\" as in \"env", "    /// variable should be set by blah\" or \"the given binary should be available", "    /// and executable by the current user\".", "    ///", "    /// For more detail on expect message styles and the reasoning behind our", "    /// recommendation please refer to the section on [\"Common Message", "    /// Styles\"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs.", "    #[inline]", "    #[track_caller]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn expect(self, msg: &str) -> T {", "        match self {", "            Some(val) => val,", "            None => expect_failed(msg),", "        }", "    }", "", "    /// Returns the contained [`Some`] value, consuming the `self` value.", "    ///", "    /// Because this function may panic, its use is generally discouraged.", "    /// Instead, prefer to use pattern matching and handle the [`None`]", "    /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or", "    /// [`unwrap_or_default`].", "    ///", "    /// [`unwrap_or`]: Option::unwrap_or", "    /// [`unwrap_or_else`]: Option::unwrap_or_else", "    /// [`unwrap_or_default`]: Option::unwrap_or_default", "    ///", "    /// # Panics", "    ///", "    /// Panics if the self value equals [`None`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"air\");", "    /// assert_eq!(x.unwrap(), \"air\");", "    /// ```", "    ///", "    /// ```should_panic", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.unwrap(), \"air\"); // fails", "    /// ```", "    #[inline]", "    #[track_caller]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn unwrap(self) -> T {", "        match self {", "            Some(val) => val,", "            None => panic(\"called `Option::unwrap()` on a `None` value\"),", "        }", "    }", "", "    /// Returns the contained [`Some`] value or a provided default.", "    ///", "    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing", "    /// the result of a function call, it is recommended to use [`unwrap_or_else`],", "    /// which is lazily evaluated.", "    ///", "    /// [`unwrap_or_else`]: Option::unwrap_or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// assert_eq!(Some(\"car\").unwrap_or(\"bike\"), \"car\");", "    /// assert_eq!(None.unwrap_or(\"bike\"), \"bike\");", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn unwrap_or(self, default: T) -> T", "    where", "        T: ~const Destruct,", "    {", "        match self {", "            Some(x) => x,", "            None => default,", "        }", "    }", "", "    /// Returns the contained [`Some`] value or computes it from a closure.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let k = 10;", "    /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);", "    /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn unwrap_or_else<F>(self, f: F) -> T", "    where", "        F: ~const FnOnce() -> T,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => x,", "            None => f(),", "        }", "    }", "", "    /// Returns the contained [`Some`] value or a default.", "    ///", "    /// Consumes the `self` argument then, if [`Some`], returns the contained", "    /// value, otherwise if [`None`], returns the [default value] for that", "    /// type.", "    ///", "    /// # Examples", "    ///", "    /// Converts a string to an integer, turning poorly-formed strings", "    /// into 0 (the default value for integers). [`parse`] converts", "    /// a string to any other type that implements [`FromStr`], returning", "    /// [`None`] on error.", "    ///", "    /// ```", "    /// let good_year_from_input = \"1909\";", "    /// let bad_year_from_input = \"190blarg\";", "    /// let good_year = good_year_from_input.parse().ok().unwrap_or_default();", "    /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();", "    ///", "    /// assert_eq!(1909, good_year);", "    /// assert_eq!(0, bad_year);", "    /// ```", "    ///", "    /// [default value]: Default::default", "    /// [`parse`]: str::parse", "    /// [`FromStr`]: crate::str::FromStr", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn unwrap_or_default(self) -> T", "    where", "        T: ~const Default,", "    {", "        match self {", "            Some(x) => x,", "            None => Default::default(),", "        }", "    }", "", "    /// Returns the contained [`Some`] value, consuming the `self` value,", "    /// without checking that the value is not [`None`].", "    ///", "    /// # Safety", "    ///", "    /// Calling this method on [`None`] is *[undefined behavior]*.", "    ///", "    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"air\");", "    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\");", "    /// ```", "    ///", "    /// ```no_run", "    /// let x: Option<&str> = None;", "    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\"); // Undefined behavior!", "    /// ```", "    #[inline]", "    #[track_caller]", "    #[stable(feature = \"option_result_unwrap_unchecked\", since = \"1.58.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const unsafe fn unwrap_unchecked(self) -> T {", "        debug_assert!(self.is_some());", "        match self {", "            Some(val) => val,", "            // SAFETY: the safety contract must be upheld by the caller.", "            None => unsafe { hint::unreachable_unchecked() },", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Transforming contained values", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.", "    ///", "    /// # Examples", "    ///", "    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming", "    /// the original:", "    ///", "    /// [String]: ../../std/string/struct.String.html \"String\"", "    /// ```", "    /// let maybe_some_string = Some(String::from(\"Hello, World!\"));", "    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`", "    /// let maybe_some_len = maybe_some_string.map(|s| s.len());", "    ///", "    /// assert_eq!(maybe_some_len, Some(13));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn map<U, F>(self, f: F) -> Option<U>", "    where", "        F: ~const FnOnce(T) -> U,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => Some(f(x)),", "            None => None,", "        }", "    }", "", "    /// Calls the provided closure with a reference to the contained value (if [`Some`]).", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(result_option_inspect)]", "    ///", "    /// let v = vec![1, 2, 3, 4, 5];", "    ///", "    /// // prints \"got: 4\"", "    /// let x: Option<&usize> = v.get(3).inspect(|x| println!(\"got: {x}\"));", "    ///", "    /// // prints nothing", "    /// let x: Option<&usize> = v.get(5).inspect(|x| println!(\"got: {x}\"));", "    /// ```", "    #[inline]", "    #[unstable(feature = \"result_option_inspect\", issue = \"91345\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn inspect<F>(self, f: F) -> Self", "    where", "        F: ~const FnOnce(&T),", "        F: ~const Destruct,", "    {", "        if let Some(ref x) = self {", "            f(x);", "        }", "", "        self", "    }", "", "    /// Returns the provided default result (if none),", "    /// or applies a function to the contained value (if any).", "    ///", "    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing", "    /// the result of a function call, it is recommended to use [`map_or_else`],", "    /// which is lazily evaluated.", "    ///", "    /// [`map_or_else`]: Option::map_or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.map_or(42, |v| v.len()), 3);", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.map_or(42, |v| v.len()), 42);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn map_or<U, F>(self, default: U, f: F) -> U", "    where", "        F: ~const FnOnce(T) -> U,", "        F: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match self {", "            Some(t) => f(t),", "            None => default,", "        }", "    }", "", "    /// Computes a default function result (if none), or", "    /// applies a different function to the contained value (if any).", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let k = 21;", "    ///", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3);", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U", "    where", "        D: ~const FnOnce() -> U,", "        D: ~const Destruct,", "        F: ~const FnOnce(T) -> U,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(t) => f(t),", "            None => default(),", "        }", "    }", "", "    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to", "    /// [`Ok(v)`] and [`None`] to [`Err(err)`].", "    ///", "    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the", "    /// result of a function call, it is recommended to use [`ok_or_else`], which is", "    /// lazily evaluated.", "    ///", "    /// [`Ok(v)`]: Ok", "    /// [`Err(err)`]: Err", "    /// [`Some(v)`]: Some", "    /// [`ok_or_else`]: Option::ok_or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.ok_or(0), Ok(\"foo\"));", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.ok_or(0), Err(0));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn ok_or<E>(self, err: E) -> Result<T, E>", "    where", "        E: ~const Destruct,", "    {", "        match self {", "            Some(v) => Ok(v),", "            None => Err(err),", "        }", "    }", "", "    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to", "    /// [`Ok(v)`] and [`None`] to [`Err(err())`].", "    ///", "    /// [`Ok(v)`]: Ok", "    /// [`Err(err())`]: Err", "    /// [`Some(v)`]: Some", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"foo\");", "    /// assert_eq!(x.ok_or_else(|| 0), Ok(\"foo\"));", "    ///", "    /// let x: Option<&str> = None;", "    /// assert_eq!(x.ok_or_else(|| 0), Err(0));", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>", "    where", "        F: ~const FnOnce() -> E,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(v) => Ok(v),", "            None => Err(err()),", "        }", "    }", "", "    /// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.", "    ///", "    /// Leaves the original Option in-place, creating a new one with a reference", "    /// to the original one, additionally coercing the contents via [`Deref`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x: Option<String> = Some(\"hey\".to_owned());", "    /// assert_eq!(x.as_deref(), Some(\"hey\"));", "    ///", "    /// let x: Option<String> = None;", "    /// assert_eq!(x.as_deref(), None);", "    /// ```", "    #[stable(feature = \"option_deref\", since = \"1.40.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_deref(&self) -> Option<&T::Target>", "    where", "        T: ~const Deref,", "    {", "        match self.as_ref() {", "            Some(t) => Some(t.deref()),", "            None => None,", "        }", "    }", "", "    /// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.", "    ///", "    /// Leaves the original `Option` in-place, creating a new one containing a mutable reference to", "    /// the inner type's [`Deref::Target`] type.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x: Option<String> = Some(\"hey\".to_owned());", "    /// assert_eq!(x.as_deref_mut().map(|x| {", "    ///     x.make_ascii_uppercase();", "    ///     x", "    /// }), Some(\"HEY\".to_owned().as_mut_str()));", "    /// ```", "    #[stable(feature = \"option_deref\", since = \"1.40.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>", "    where", "        T: ~const DerefMut,", "    {", "        match self.as_mut() {", "            Some(t) => Some(t.deref_mut()),", "            None => None,", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Iterator constructors", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns an iterator over the possibly contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(4);", "    /// assert_eq!(x.iter().next(), Some(&4));", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.iter().next(), None);", "    /// ```", "    #[inline]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    pub const fn iter(&self) -> Iter<'_, T> {", "        Iter { inner: Item { opt: self.as_ref() } }", "    }", "", "    /// Returns a mutable iterator over the possibly contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(4);", "    /// match x.iter_mut().next() {", "    ///     Some(v) => *v = 42,", "    ///     None => {},", "    /// }", "    /// assert_eq!(x, Some(42));", "    ///", "    /// let mut x: Option<u32> = None;", "    /// assert_eq!(x.iter_mut().next(), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    pub fn iter_mut(&mut self) -> IterMut<'_, T> {", "        IterMut { inner: Item { opt: self.as_mut() } }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Boolean operations on the values, eager and lazy", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Returns [`None`] if the option is [`None`], otherwise returns `optb`.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(2);", "    /// let y: Option<&str> = None;", "    /// assert_eq!(x.and(y), None);", "    ///", "    /// let x: Option<u32> = None;", "    /// let y = Some(\"foo\");", "    /// assert_eq!(x.and(y), None);", "    ///", "    /// let x = Some(2);", "    /// let y = Some(\"foo\");", "    /// assert_eq!(x.and(y), Some(\"foo\"));", "    ///", "    /// let x: Option<u32> = None;", "    /// let y: Option<&str> = None;", "    /// assert_eq!(x.and(y), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn and<U>(self, optb: Option<U>) -> Option<U>", "    where", "        T: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match self {", "            Some(_) => optb,", "            None => None,", "        }", "    }", "", "    /// Returns [`None`] if the option is [`None`], otherwise calls `f` with the", "    /// wrapped value and returns the result.", "    ///", "    /// Some languages call this operation flatmap.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// fn sq_then_to_string(x: u32) -> Option<String> {", "    ///     x.checked_mul(x).map(|sq| sq.to_string())", "    /// }", "    ///", "    /// assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string()));", "    /// assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed!", "    /// assert_eq!(None.and_then(sq_then_to_string), None);", "    /// ```", "    ///", "    /// Often used to chain fallible operations that may return [`None`].", "    ///", "    /// ```", "    /// let arr_2d = [[\"A0\", \"A1\"], [\"B0\", \"B1\"]];", "    ///", "    /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1));", "    /// assert_eq!(item_0_1, Some(&\"A1\"));", "    ///", "    /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));", "    /// assert_eq!(item_2_0, None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn and_then<U, F>(self, f: F) -> Option<U>", "    where", "        F: ~const FnOnce(T) -> Option<U>,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => f(x),", "            None => None,", "        }", "    }", "", "    /// Returns [`None`] if the option is [`None`], otherwise calls `predicate`", "    /// with the wrapped value and returns:", "    ///", "    /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped", "    ///   value), and", "    /// - [`None`] if `predicate` returns `false`.", "    ///", "    /// This function works similar to [`Iterator::filter()`]. You can imagine", "    /// the `Option<T>` being an iterator over one or zero elements. `filter()`", "    /// lets you decide which elements to keep.", "    ///", "    /// # Examples", "    ///", "    /// ```rust", "    /// fn is_even(n: &i32) -> bool {", "    ///     n % 2 == 0", "    /// }", "    ///", "    /// assert_eq!(None.filter(is_even), None);", "    /// assert_eq!(Some(3).filter(is_even), None);", "    /// assert_eq!(Some(4).filter(is_even), Some(4));", "    /// ```", "    ///", "    /// [`Some(t)`]: Some", "    #[inline]", "    #[stable(feature = \"option_filter\", since = \"1.27.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn filter<P>(self, predicate: P) -> Self", "    where", "        T: ~const Destruct,", "        P: ~const FnOnce(&T) -> bool,", "        P: ~const Destruct,", "    {", "        if let Some(x) = self {", "            if predicate(&x) {", "                return Some(x);", "            }", "        }", "        None", "    }", "", "    /// Returns the option if it contains a value, otherwise returns `optb`.", "    ///", "    /// Arguments passed to `or` are eagerly evaluated; if you are passing the", "    /// result of a function call, it is recommended to use [`or_else`], which is", "    /// lazily evaluated.", "    ///", "    /// [`or_else`]: Option::or_else", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(2);", "    /// let y = None;", "    /// assert_eq!(x.or(y), Some(2));", "    ///", "    /// let x = None;", "    /// let y = Some(100);", "    /// assert_eq!(x.or(y), Some(100));", "    ///", "    /// let x = Some(2);", "    /// let y = Some(100);", "    /// assert_eq!(x.or(y), Some(2));", "    ///", "    /// let x: Option<u32> = None;", "    /// let y = None;", "    /// assert_eq!(x.or(y), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn or(self, optb: Option<T>) -> Option<T>", "    where", "        T: ~const Destruct,", "    {", "        match self {", "            Some(x) => Some(x),", "            None => optb,", "        }", "    }", "", "    /// Returns the option if it contains a value, otherwise calls `f` and", "    /// returns the result.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// fn nobody() -> Option<&'static str> { None }", "    /// fn vikings() -> Option<&'static str> { Some(\"vikings\") }", "    ///", "    /// assert_eq!(Some(\"barbarians\").or_else(vikings), Some(\"barbarians\"));", "    /// assert_eq!(None.or_else(vikings), Some(\"vikings\"));", "    /// assert_eq!(None.or_else(nobody), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn or_else<F>(self, f: F) -> Option<T>", "    where", "        F: ~const FnOnce() -> Option<T>,", "        F: ~const Destruct,", "    {", "        match self {", "            Some(x) => Some(x),", "            None => f(),", "        }", "    }", "", "    /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(2);", "    /// let y: Option<u32> = None;", "    /// assert_eq!(x.xor(y), Some(2));", "    ///", "    /// let x: Option<u32> = None;", "    /// let y = Some(2);", "    /// assert_eq!(x.xor(y), Some(2));", "    ///", "    /// let x = Some(2);", "    /// let y = Some(2);", "    /// assert_eq!(x.xor(y), None);", "    ///", "    /// let x: Option<u32> = None;", "    /// let y: Option<u32> = None;", "    /// assert_eq!(x.xor(y), None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_xor\", since = \"1.37.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn xor(self, optb: Option<T>) -> Option<T>", "    where", "        T: ~const Destruct,", "    {", "        match (self, optb) {", "            (Some(a), None) => Some(a),", "            (None, Some(b)) => Some(b),", "            _ => None,", "        }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Entry-like operations to insert a value and return a reference", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Inserts `value` into the option, then returns a mutable reference to it.", "    ///", "    /// If the option already contains a value, the old value is dropped.", "    ///", "    /// See also [`Option::get_or_insert`], which doesn't update the value if", "    /// the option already contains [`Some`].", "    ///", "    /// # Example", "    ///", "    /// ```", "    /// let mut opt = None;", "    /// let val = opt.insert(1);", "    /// assert_eq!(*val, 1);", "    /// assert_eq!(opt.unwrap(), 1);", "    /// let val = opt.insert(2);", "    /// assert_eq!(*val, 2);", "    /// *val = 3;", "    /// assert_eq!(opt.unwrap(), 3);", "    /// ```", "    #[must_use = \"if you intended to set a value, consider assignment instead\"]", "    #[inline]", "    #[stable(feature = \"option_insert\", since = \"1.53.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn insert(&mut self, value: T) -> &mut T", "    where", "        T: ~const Destruct,", "    {", "        *self = Some(value);", "", "        // SAFETY: the code above just filled the option", "        unsafe { self.as_mut().unwrap_unchecked() }", "    }", "", "    /// Inserts `value` into the option if it is [`None`], then", "    /// returns a mutable reference to the contained value.", "    ///", "    /// See also [`Option::insert`], which updates the value even if", "    /// the option already contains [`Some`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = None;", "    ///", "    /// {", "    ///     let y: &mut u32 = x.get_or_insert(5);", "    ///     assert_eq!(y, &5);", "    ///", "    ///     *y = 7;", "    /// }", "    ///", "    /// assert_eq!(x, Some(7));", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_entry\", since = \"1.20.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn get_or_insert(&mut self, value: T) -> &mut T", "    where", "        T: ~const Destruct,", "    {", "        if let None = *self {", "            *self = Some(value);", "        }", "", "        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`", "        // variant in the code above.", "        unsafe { self.as_mut().unwrap_unchecked() }", "    }", "", "    /// Inserts the default value into the option if it is [`None`], then", "    /// returns a mutable reference to the contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(option_get_or_insert_default)]", "    ///", "    /// let mut x = None;", "    ///", "    /// {", "    ///     let y: &mut u32 = x.get_or_insert_default();", "    ///     assert_eq!(y, &0);", "    ///", "    ///     *y = 7;", "    /// }", "    ///", "    /// assert_eq!(x, Some(7));", "    /// ```", "    #[inline]", "    #[unstable(feature = \"option_get_or_insert_default\", issue = \"82901\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn get_or_insert_default(&mut self) -> &mut T", "    where", "        T: ~const Default,", "    {", "        const fn default<T: ~const Default>() -> T {", "            T::default()", "        }", "", "        self.get_or_insert_with(default)", "    }", "", "    /// Inserts a value computed from `f` into the option if it is [`None`],", "    /// then returns a mutable reference to the contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = None;", "    ///", "    /// {", "    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);", "    ///     assert_eq!(y, &5);", "    ///", "    ///     *y = 7;", "    /// }", "    ///", "    /// assert_eq!(x, Some(7));", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_entry\", since = \"1.20.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T", "    where", "        F: ~const FnOnce() -> T,", "        F: ~const Destruct,", "    {", "        if let None = *self {", "            // the compiler isn't smart enough to know that we are not dropping a `T`", "            // here and wants us to ensure `T` can be dropped at compile time.", "            mem::forget(mem::replace(self, Some(f())))", "        }", "", "        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`", "        // variant in the code above.", "        unsafe { self.as_mut().unwrap_unchecked() }", "    }", "", "    /////////////////////////////////////////////////////////////////////////", "    // Misc", "    /////////////////////////////////////////////////////////////////////////", "", "    /// Takes the value out of the option, leaving a [`None`] in its place.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(2);", "    /// let y = x.take();", "    /// assert_eq!(x, None);", "    /// assert_eq!(y, Some(2));", "    ///", "    /// let mut x: Option<u32> = None;", "    /// let y = x.take();", "    /// assert_eq!(x, None);", "    /// assert_eq!(y, None);", "    /// ```", "    #[inline]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn take(&mut self) -> Option<T> {", "        // FIXME replace `mem::replace` by `mem::take` when the latter is const ready", "        mem::replace(self, None)", "    }", "", "    /// Replaces the actual value in the option by the value given in parameter,", "    /// returning the old value if present,", "    /// leaving a [`Some`] in its place without deinitializing either one.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = Some(2);", "    /// let old = x.replace(5);", "    /// assert_eq!(x, Some(5));", "    /// assert_eq!(old, Some(2));", "    ///", "    /// let mut x = None;", "    /// let old = x.replace(3);", "    /// assert_eq!(x, Some(3));", "    /// assert_eq!(old, None);", "    /// ```", "    #[inline]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    #[stable(feature = \"option_replace\", since = \"1.31.0\")]", "    pub const fn replace(&mut self, value: T) -> Option<T> {", "        mem::replace(self, Some(value))", "    }", "", "    /// Returns `true` if the option is a [`Some`] value containing the given value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(option_result_contains)]", "    ///", "    /// let x: Option<u32> = Some(2);", "    /// assert_eq!(x.contains(&2), true);", "    ///", "    /// let x: Option<u32> = Some(3);", "    /// assert_eq!(x.contains(&2), false);", "    ///", "    /// let x: Option<u32> = None;", "    /// assert_eq!(x.contains(&2), false);", "    /// ```", "    #[must_use]", "    #[inline]", "    #[unstable(feature = \"option_result_contains\", issue = \"62358\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn contains<U>(&self, x: &U) -> bool", "    where", "        U: ~const PartialEq<T>,", "    {", "        match self {", "            Some(y) => x.eq(y),", "            None => false,", "        }", "    }", "", "    /// Zips `self` with another `Option`.", "    ///", "    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.", "    /// Otherwise, `None` is returned.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(1);", "    /// let y = Some(\"hi\");", "    /// let z = None::<u8>;", "    ///", "    /// assert_eq!(x.zip(y), Some((1, \"hi\")));", "    /// assert_eq!(x.zip(z), None);", "    /// ```", "    #[stable(feature = \"option_zip_option\", since = \"1.46.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>", "    where", "        T: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match (self, other) {", "            (Some(a), Some(b)) => Some((a, b)),", "            _ => None,", "        }", "    }", "", "    /// Zips `self` and another `Option` with function `f`.", "    ///", "    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`.", "    /// Otherwise, `None` is returned.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(option_zip)]", "    ///", "    /// #[derive(Debug, PartialEq)]", "    /// struct Point {", "    ///     x: f64,", "    ///     y: f64,", "    /// }", "    ///", "    /// impl Point {", "    ///     fn new(x: f64, y: f64) -> Self {", "    ///         Self { x, y }", "    ///     }", "    /// }", "    ///", "    /// let x = Some(17.5);", "    /// let y = Some(42.7);", "    ///", "    /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 }));", "    /// assert_eq!(x.zip_with(None, Point::new), None);", "    /// ```", "    #[unstable(feature = \"option_zip\", issue = \"70086\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>", "    where", "        F: ~const FnOnce(T, U) -> R,", "        F: ~const Destruct,", "        T: ~const Destruct,", "        U: ~const Destruct,", "    {", "        match (self, other) {", "            (Some(a), Some(b)) => Some(f(a, b)),", "            _ => None,", "        }", "    }", "}", "", "impl<T, U> Option<(T, U)> {", "    /// Unzips an option containing a tuple of two options.", "    ///", "    /// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.", "    /// Otherwise, `(None, None)` is returned.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #![feature(unzip_option)]", "    ///", "    /// let x = Some((1, \"hi\"));", "    /// let y = None::<(u8, u32)>;", "    ///", "    /// assert_eq!(x.unzip(), (Some(1), Some(\"hi\")));", "    /// assert_eq!(y.unzip(), (None, None));", "    /// ```", "    #[inline]", "    #[unstable(feature = \"unzip_option\", issue = \"87800\", reason = \"recently added\")]", "    pub const fn unzip(self) -> (Option<T>, Option<U>) {", "        match self {", "            Some((a, b)) => (Some(a), Some(b)),", "            None => (None, None),", "        }", "    }", "}", "", "impl<T> Option<&T> {", "    /// Maps an `Option<&T>` to an `Option<T>` by copying the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = 12;", "    /// let opt_x = Some(&x);", "    /// assert_eq!(opt_x, Some(&12));", "    /// let copied = opt_x.copied();", "    /// assert_eq!(copied, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(feature = \"copied\", since = \"1.35.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn copied(self) -> Option<T>", "    where", "        T: Copy,", "    {", "        // FIXME: this implementation, which sidesteps using `Option::map` since it's not const", "        // ready yet, should be reverted when possible to avoid code repetition", "        match self {", "            Some(&v) => Some(v),", "            None => None,", "        }", "    }", "", "    /// Maps an `Option<&T>` to an `Option<T>` by cloning the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = 12;", "    /// let opt_x = Some(&x);", "    /// assert_eq!(opt_x, Some(&12));", "    /// let cloned = opt_x.cloned();", "    /// assert_eq!(cloned, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(feature = \"rust1\", since = \"1.0.0\")]", "    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]", "    pub const fn cloned(self) -> Option<T>", "    where", "        T: ~const Clone,", "    {", "        match self {", "            Some(t) => Some(t.clone()),", "            None => None,", "        }", "    }", "}", "", "impl<T> Option<&mut T> {", "    /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = 12;", "    /// let opt_x = Some(&mut x);", "    /// assert_eq!(opt_x, Some(&mut 12));", "    /// let copied = opt_x.copied();", "    /// assert_eq!(copied, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(feature = \"copied\", since = \"1.35.0\")]", "    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]", "    pub const fn copied(self) -> Option<T>", "    where", "        T: Copy,", "    {", "        match self {", "            Some(&mut t) => Some(t),", "            None => None,", "        }", "    }", "", "    /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the", "    /// option.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut x = 12;", "    /// let opt_x = Some(&mut x);", "    /// assert_eq!(opt_x, Some(&mut 12));", "    /// let cloned = opt_x.cloned();", "    /// assert_eq!(cloned, Some(12));", "    /// ```", "    #[must_use = \"`self` will be dropped if the result is not used\"]", "    #[stable(since = \"1.26.0\", feature = \"option_ref_mut_cloned\")]", "    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]", "    pub const fn cloned(self) -> Option<T>", "    where", "        T: ~const Clone,", "    {", "        match self {", "            Some(t) => Some(t.clone()),", "            None => None,", "        }", "    }", "}", "", "impl<T, E> Option<Result<T, E>> {", "    /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.", "    ///", "    /// [`None`] will be mapped to <code>[Ok]\\([None])</code>.", "    /// <code>[Some]\\([Ok]\\(\\_))</code> and <code>[Some]\\([Err]\\(\\_))</code> will be mapped to", "    /// <code>[Ok]\\([Some]\\(\\_))</code> and <code>[Err]\\(\\_)</code>.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// #[derive(Debug, Eq, PartialEq)]", "    /// struct SomeErr;", "    ///", "    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));", "    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));", "    /// assert_eq!(x, y.transpose());", "    /// ```", "    #[inline]", "    #[stable(feature = \"transpose_result\", since = \"1.33.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn transpose(self) -> Result<Option<T>, E> {", "        match self {", "            Some(Ok(x)) => Ok(Some(x)),", "            Some(Err(e)) => Err(e),", "            None => Ok(None),", "        }", "    }", "}", "", "// This is a separate function to reduce the code size of .expect() itself.", "#[cfg_attr(not(feature = \"panic_immediate_abort\"), inline(never))]", "#[cfg_attr(feature = \"panic_immediate_abort\", inline)]", "#[cold]", "#[track_caller]", "#[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "const fn expect_failed(msg: &str) -> ! {", "    panic_str(msg)", "}", "", "/////////////////////////////////////////////////////////////////////////////", "// Trait implementations", "/////////////////////////////////////////////////////////////////////////////", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[rustc_const_unstable(feature = \"const_clone\", issue = \"91805\")]", "impl<T> const Clone for Option<T>", "where", "    T: ~const Clone + ~const Destruct,", "{", "    #[inline]", "    fn clone(&self) -> Self {", "        match self {", "            Some(x) => Some(x.clone()),", "            None => None,", "        }", "    }", "", "    #[inline]", "    fn clone_from(&mut self, source: &Self) {", "        match (self, source) {", "            (Some(to), Some(from)) => to.clone_from(from),", "            (to, from) => *to = from.clone(),", "        }", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[rustc_const_unstable(feature = \"const_default_impls\", issue = \"87864\")]", "impl<T> const Default for Option<T> {", "    /// Returns [`None`][Option::None].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let opt: Option<u32> = Option::default();", "    /// assert!(opt.is_none());", "    /// ```", "    #[inline]", "    fn default() -> Option<T> {", "        None", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<T> IntoIterator for Option<T> {", "    type Item = T;", "    type IntoIter = IntoIter<T>;", "", "    /// Returns a consuming iterator over the possibly contained value.", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let x = Some(\"string\");", "    /// let v: Vec<&str> = x.into_iter().collect();", "    /// assert_eq!(v, [\"string\"]);", "    ///", "    /// let x = None;", "    /// let v: Vec<&str> = x.into_iter().collect();", "    /// assert!(v.is_empty());", "    /// ```", "    #[inline]", "    fn into_iter(self) -> IntoIter<T> {", "        IntoIter { inner: Item { opt: self } }", "    }", "}", "", "#[stable(since = \"1.4.0\", feature = \"option_iter\")]", "impl<'a, T> IntoIterator for &'a Option<T> {", "    type Item = &'a T;", "    type IntoIter = Iter<'a, T>;", "", "    fn into_iter(self) -> Iter<'a, T> {", "        self.iter()", "    }", "}", "", "#[stable(since = \"1.4.0\", feature = \"option_iter\")]", "impl<'a, T> IntoIterator for &'a mut Option<T> {", "    type Item = &'a mut T;", "    type IntoIter = IterMut<'a, T>;", "", "    fn into_iter(self) -> IterMut<'a, T> {", "        self.iter_mut()", "    }", "}", "", "#[stable(since = \"1.12.0\", feature = \"option_from\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<T> const From<T> for Option<T> {", "    /// Moves `val` into a new [`Some`].", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let o: Option<u8> = Option::from(67);", "    ///", "    /// assert_eq!(Some(67), o);", "    /// ```", "    fn from(val: T) -> Option<T> {", "        Some(val)", "    }", "}", "", "#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<'a, T> const From<&'a Option<T>> for Option<&'a T> {", "    /// Converts from `&Option<T>` to `Option<&T>`.", "    ///", "    /// # Examples", "    ///", "    /// Converts an <code>[Option]<[String]></code> into an <code>[Option]<[usize]></code>, preserving", "    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,", "    /// so this technique uses `from` to first take an [`Option`] to a reference", "    /// to the value inside the original.", "    ///", "    /// [`map`]: Option::map", "    /// [String]: ../../std/string/struct.String.html \"String\"", "    ///", "    /// ```", "    /// let s: Option<String> = Some(String::from(\"Hello, Rustaceans!\"));", "    /// let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());", "    ///", "    /// println!(\"Can still print s: {s:?}\");", "    ///", "    /// assert_eq!(o, Some(18));", "    /// ```", "    fn from(o: &'a Option<T>) -> Option<&'a T> {", "        o.as_ref()", "    }", "}", "", "#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {", "    /// Converts from `&mut Option<T>` to `Option<&mut T>`", "    ///", "    /// # Examples", "    ///", "    /// ```", "    /// let mut s = Some(String::from(\"Hello\"));", "    /// let o: Option<&mut String> = Option::from(&mut s);", "    ///", "    /// match o {", "    ///     Some(t) => *t = String::from(\"Hello, Rustaceans!\"),", "    ///     None => (),", "    /// }", "    ///", "    /// assert_eq!(s, Some(String::from(\"Hello, Rustaceans!\")));", "    /// ```", "    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {", "        o.as_mut()", "    }", "}", "", "/////////////////////////////////////////////////////////////////////////////", "// The Option Iterators", "/////////////////////////////////////////////////////////////////////////////", "", "#[derive(Clone, Debug)]", "struct Item<A> {", "    opt: Option<A>,", "}", "", "impl<A> Iterator for Item<A> {", "    type Item = A;", "", "    #[inline]", "    fn next(&mut self) -> Option<A> {", "        self.opt.take()", "    }", "", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        match self.opt {", "            Some(_) => (1, Some(1)),", "            None => (0, Some(0)),", "        }", "    }", "}", "", "impl<A> DoubleEndedIterator for Item<A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<A> {", "        self.opt.take()", "    }", "}", "", "impl<A> ExactSizeIterator for Item<A> {}", "impl<A> FusedIterator for Item<A> {}", "unsafe impl<A> TrustedLen for Item<A> {}", "", "/// An iterator over a reference to the [`Some`] variant of an [`Option`].", "///", "/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.", "///", "/// This `struct` is created by the [`Option::iter`] function.", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[derive(Debug)]", "pub struct Iter<'a, A: 'a> {", "    inner: Item<&'a A>,", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> Iterator for Iter<'a, A> {", "    type Item = &'a A;", "", "    #[inline]", "    fn next(&mut self) -> Option<&'a A> {", "        self.inner.next()", "    }", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        self.inner.size_hint()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> DoubleEndedIterator for Iter<'a, A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<&'a A> {", "        self.inner.next_back()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> ExactSizeIterator for Iter<'_, A> {}", "", "#[stable(feature = \"fused\", since = \"1.26.0\")]", "impl<A> FusedIterator for Iter<'_, A> {}", "", "#[unstable(feature = \"trusted_len\", issue = \"37572\")]", "unsafe impl<A> TrustedLen for Iter<'_, A> {}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> Clone for Iter<'_, A> {", "    #[inline]", "    fn clone(&self) -> Self {", "        Iter { inner: self.inner.clone() }", "    }", "}", "", "/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].", "///", "/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.", "///", "/// This `struct` is created by the [`Option::iter_mut`] function.", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "#[derive(Debug)]", "pub struct IterMut<'a, A: 'a> {", "    inner: Item<&'a mut A>,", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> Iterator for IterMut<'a, A> {", "    type Item = &'a mut A;", "", "    #[inline]", "    fn next(&mut self) -> Option<&'a mut A> {", "        self.inner.next()", "    }", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        self.inner.size_hint()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<&'a mut A> {", "        self.inner.next_back()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> ExactSizeIterator for IterMut<'_, A> {}", "", "#[stable(feature = \"fused\", since = \"1.26.0\")]", "impl<A> FusedIterator for IterMut<'_, A> {}", "#[unstable(feature = \"trusted_len\", issue = \"37572\")]", "unsafe impl<A> TrustedLen for IterMut<'_, A> {}", "", "/// An iterator over the value in [`Some`] variant of an [`Option`].", "///", "/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.", "///", "/// This `struct` is created by the [`Option::into_iter`] function.", "#[derive(Clone, Debug)]", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "pub struct IntoIter<A> {", "    inner: Item<A>,", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> Iterator for IntoIter<A> {", "    type Item = A;", "", "    #[inline]", "    fn next(&mut self) -> Option<A> {", "        self.inner.next()", "    }", "    #[inline]", "    fn size_hint(&self) -> (usize, Option<usize>) {", "        self.inner.size_hint()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> DoubleEndedIterator for IntoIter<A> {", "    #[inline]", "    fn next_back(&mut self) -> Option<A> {", "        self.inner.next_back()", "    }", "}", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A> ExactSizeIterator for IntoIter<A> {}", "", "#[stable(feature = \"fused\", since = \"1.26.0\")]", "impl<A> FusedIterator for IntoIter<A> {}", "", "#[unstable(feature = \"trusted_len\", issue = \"37572\")]", "unsafe impl<A> TrustedLen for IntoIter<A> {}", "", "/////////////////////////////////////////////////////////////////////////////", "// FromIterator", "/////////////////////////////////////////////////////////////////////////////", "", "#[stable(feature = \"rust1\", since = \"1.0.0\")]", "impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {", "    /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],", "    /// no further elements are taken, and the [`None`][Option::None] is", "    /// returned. Should no [`None`][Option::None] occur, a container of type", "    /// `V` containing the values of each [`Option`] is returned.", "    ///", "    /// # Examples", "    ///", "    /// Here is an example which increments every integer in a vector.", "    /// We use the checked variant of `add` that returns `None` when the", "    /// calculation would result in an overflow.", "    ///", "    /// ```", "    /// let items = vec![0_u16, 1, 2];", "    ///", "    /// let res: Option<Vec<u16>> = items", "    ///     .iter()", "    ///     .map(|x| x.checked_add(1))", "    ///     .collect();", "    ///", "    /// assert_eq!(res, Some(vec![1, 2, 3]));", "    /// ```", "    ///", "    /// As you can see, this will return the expected, valid items.", "    ///", "    /// Here is another example that tries to subtract one from another list", "    /// of integers, this time checking for underflow:", "    ///", "    /// ```", "    /// let items = vec![2_u16, 1, 0];", "    ///", "    /// let res: Option<Vec<u16>> = items", "    ///     .iter()", "    ///     .map(|x| x.checked_sub(1))", "    ///     .collect();", "    ///", "    /// assert_eq!(res, None);", "    /// ```", "    ///", "    /// Since the last element is zero, it would underflow. Thus, the resulting", "    /// value is `None`.", "    ///", "    /// Here is a variation on the previous example, showing that no", "    /// further elements are taken from `iter` after the first `None`.", "    ///", "    /// ```", "    /// let items = vec![3_u16, 2, 1, 10];", "    ///", "    /// let mut shared = 0;", "    ///", "    /// let res: Option<Vec<u16>> = items", "    ///     .iter()", "    ///     .map(|x| { shared += x; x.checked_sub(2) })", "    ///     .collect();", "    ///", "    /// assert_eq!(res, None);", "    /// assert_eq!(shared, 6);", "    /// ```", "    ///", "    /// Since the third element caused an underflow, no further elements were taken,", "    /// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.", "    #[inline]", "    fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {", "        // FIXME(#11084): This could be replaced with Iterator::scan when this", "        // performance bug is closed.", "", "        iter::try_process(iter.into_iter(), |i| i.collect())", "    }", "}", "", "#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<T> const ops::Try for Option<T> {", "    type Output = T;", "    type Residual = Option<convert::Infallible>;", "", "    #[inline]", "    fn from_output(output: Self::Output) -> Self {", "        Some(output)", "    }", "", "    #[inline]", "    fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {", "        match self {", "            Some(v) => ControlFlow::Continue(v),", "            None => ControlFlow::Break(None),", "        }", "    }", "}", "", "#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]", "#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]", "impl<T> const ops::FromResidual for Option<T> {", "    #[inline]", "    fn from_residual(residual: Option<convert::Infallible>) -> Self {", "        match residual {", "            None => None,", "        }", "    }", "}", "", "#[unstable(feature = \"try_trait_v2_yeet\", issue = \"96374\")]", "impl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {", "    #[inline]", "    fn from_residual(ops::Yeet(()): ops::Yeet<()>) -> Self {", "        None", "    }", "}", "", "#[unstable(feature = \"try_trait_v2_residual\", issue = \"91285\")]", "impl<T> ops::Residual<T> for Option<convert::Infallible> {", "    type TryType = Option<T>;", "}", "", "impl<T> Option<Option<T>> {", "    /// Converts from `Option<Option<T>>` to `Option<T>`.", "    ///", "    /// # Examples", "    ///", "    /// Basic usage:", "    ///", "    /// ```", "    /// let x: Option<Option<u32>> = Some(Some(6));", "    /// assert_eq!(Some(6), x.flatten());", "    ///", "    /// let x: Option<Option<u32>> = Some(None);", "    /// assert_eq!(None, x.flatten());", "    ///", "    /// let x: Option<Option<u32>> = None;", "    /// assert_eq!(None, x.flatten());", "    /// ```", "    ///", "    /// Flattening only removes one level of nesting at a time:", "    ///", "    /// ```", "    /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));", "    /// assert_eq!(Some(Some(6)), x.flatten());", "    /// assert_eq!(Some(6), x.flatten().flatten());", "    /// ```", "    #[inline]", "    #[stable(feature = \"option_flattening\", since = \"1.40.0\")]", "    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]", "    pub const fn flatten(self) -> Option<T> {", "        match self {", "            Some(inner) => inner,", "            None => None,", "        }", "    }", "}", ""]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"eval","params":["s:GetVar('LanguageClient_setOmnifunc', v:true)"],"id":30}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 30, "jsonrpc": "2.0", "result": true}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.text_documents./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> {"languageId":"rust","text":"//! Optional values.\n//!\n//! Type [`Option`] represents an optional value: every [`Option`]\n//! is either [`Some`] and contains a value, or [`None`], and\n//! does not. [`Option`] types are very common in Rust code, as\n//! they have a number of uses:\n//!\n//! * Initial values\n//! * Return values for functions that are not defined\n//!   over their entire input range (partial functions)\n//! * Return value for otherwise reporting simple errors, where [`None`] is\n//!   returned on error\n//! * Optional struct fields\n//! * Struct fields that can be loaned or \"taken\"\n//! * Optional function arguments\n//! * Nullable pointers\n//! * Swapping things out of difficult situations\n//!\n//! [`Option`]s are commonly paired with pattern matching to query the presence\n//! of a value and take action, always accounting for the [`None`] case.\n//!\n//! ```\n//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {\n//!     if denominator == 0.0 {\n//!         None\n//!     } else {\n//!         Some(numerator / denominator)\n//!     }\n//! }\n//!\n//! // The return value of the function is an option\n//! let result = divide(2.0, 3.0);\n//!\n//! // Pattern match to retrieve the value\n//! match result {\n//!     // The division was valid\n//!     Some(x) => println!(\"Result: {x}\"),\n//!     // The division was invalid\n//!     None    => println!(\"Cannot divide by 0\"),\n//! }\n//! ```\n//!\n//\n// FIXME: Show how `Option` is used in practice, with lots of methods\n//\n//! # Options and pointers (\"nullable\" pointers)\n//!\n//! Rust's pointer types must always point to a valid location; there are\n//! no \"null\" references. Instead, Rust has *optional* pointers, like\n//! the optional owned box, <code>[Option]<[Box\\<T>]></code>.\n//!\n//! [Box\\<T>]: ../../std/boxed/struct.Box.html\n//!\n//! The following example uses [`Option`] to create an optional box of\n//! [`i32`]. Notice that in order to use the inner [`i32`] value, the\n//! `check_optional` function first needs to use pattern matching to\n//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or\n//! not ([`None`]).\n//!\n//! ```\n//! let optional = None;\n//! check_optional(optional);\n//!\n//! let optional = Some(Box::new(9000));\n//! check_optional(optional);\n//!\n//! fn check_optional(optional: Option<Box<i32>>) {\n//!     match optional {\n//!         Some(p) => println!(\"has value {p}\"),\n//!         None => println!(\"has no value\"),\n//!     }\n//! }\n//! ```\n//!\n//! # Representation\n//!\n//! Rust guarantees to optimize the following types `T` such that\n//! [`Option<T>`] has the same size as `T`:\n//!\n//! * [`Box<U>`]\n//! * `&U`\n//! * `&mut U`\n//! * `fn`, `extern \"C\" fn`[^extern_fn]\n//! * [`num::NonZero*`]\n//! * [`ptr::NonNull<U>`]\n//! * `#[repr(transparent)]` struct around one of the types in this list.\n//!\n//! [^extern_fn]: this remains true for any other ABI: `extern \"abi\" fn` (_e.g._, `extern \"system\" fn`)\n//!\n//! [`Box<U>`]: ../../std/boxed/struct.Box.html\n//! [`num::NonZero*`]: crate::num\n//! [`ptr::NonNull<U>`]: crate::ptr::NonNull\n//!\n//! This is called the \"null pointer optimization\" or NPO.\n//!\n//! It is further guaranteed that, for the cases above, one can\n//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and\n//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`\n//! is undefined behaviour).\n//!\n//! # Method overview\n//!\n//! In addition to working with pattern matching, [`Option`] provides a wide\n//! variety of different methods.\n//!\n//! ## Querying the variant\n//!\n//! The [`is_some`] and [`is_none`] methods return [`true`] if the [`Option`]\n//! is [`Some`] or [`None`], respectively.\n//!\n//! [`is_none`]: Option::is_none\n//! [`is_some`]: Option::is_some\n//!\n//! ## Adapters for working with references\n//!\n//! * [`as_ref`] converts from <code>[&][][Option]\\<T></code> to <code>[Option]<[&]T></code>\n//! * [`as_mut`] converts from <code>[&mut] [Option]\\<T></code> to <code>[Option]<[&mut] T></code>\n//! * [`as_deref`] converts from <code>[&][][Option]\\<T></code> to\n//!   <code>[Option]<[&]T::[Target]></code>\n//! * [`as_deref_mut`] converts from <code>[&mut] [Option]\\<T></code> to\n//!   <code>[Option]<[&mut] T::[Target]></code>\n//! * [`as_pin_ref`] converts from <code>[Pin]<[&][][Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&]T>></code>\n//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&mut] T>></code>\n//!\n//! [&]: reference \"shared reference\"\n//! [&mut]: reference \"mutable reference\"\n//! [Target]: Deref::Target \"ops::Deref::Target\"\n//! [`as_deref`]: Option::as_deref\n//! [`as_deref_mut`]: Option::as_deref_mut\n//! [`as_mut`]: Option::as_mut\n//! [`as_pin_mut`]: Option::as_pin_mut\n//! [`as_pin_ref`]: Option::as_pin_ref\n//! [`as_ref`]: Option::as_ref\n//!\n//! ## Extracting the contained value\n//!\n//! These methods extract the contained value in an [`Option<T>`] when it\n//! is the [`Some`] variant. If the [`Option`] is [`None`]:\n//!\n//! * [`expect`] panics with a provided custom message\n//! * [`unwrap`] panics with a generic message\n//! * [`unwrap_or`] returns the provided default value\n//! * [`unwrap_or_default`] returns the default value of the type `T`\n//!   (which must implement the [`Default`] trait)\n//! * [`unwrap_or_else`] returns the result of evaluating the provided\n//!   function\n//!\n//! [`expect`]: Option::expect\n//! [`unwrap`]: Option::unwrap\n//! [`unwrap_or`]: Option::unwrap_or\n//! [`unwrap_or_default`]: Option::unwrap_or_default\n//! [`unwrap_or_else`]: Option::unwrap_or_else\n//!\n//! ## Transforming contained values\n//!\n//! These methods transform [`Option`] to [`Result`]:\n//!\n//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   [`Err(err)`] using the provided default `err` value\n//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   a value of [`Err`] using the provided function\n//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a\n//!   [`Result`] of an [`Option`]\n//!\n//! [`Err(err)`]: Err\n//! [`Ok(v)`]: Ok\n//! [`Some(v)`]: Some\n//! [`ok_or`]: Option::ok_or\n//! [`ok_or_else`]: Option::ok_or_else\n//! [`transpose`]: Option::transpose\n//!\n//! These methods transform the [`Some`] variant:\n//!\n//! * [`filter`] calls the provided predicate function on the contained\n//!   value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]\n//!   if the function returns `true`; otherwise, returns [`None`]\n//! * [`flatten`] removes one level of nesting from an\n//!   [`Option<Option<T>>`]\n//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the\n//!   provided function to the contained value of [`Some`] and leaving\n//!   [`None`] values unchanged\n//!\n//! [`Some(t)`]: Some\n//! [`filter`]: Option::filter\n//! [`flatten`]: Option::flatten\n//! [`map`]: Option::map\n//!\n//! These methods transform [`Option<T>`] to a value of a possibly\n//! different type `U`:\n//!\n//! * [`map_or`] applies the provided function to the contained value of\n//!   [`Some`], or returns the provided default value if the [`Option`] is\n//!   [`None`]\n//! * [`map_or_else`] applies the provided function to the contained value\n//!   of [`Some`], or returns the result of evaluating the provided\n//!   fallback function if the [`Option`] is [`None`]\n//!\n//! [`map_or`]: Option::map_or\n//! [`map_or_else`]: Option::map_or_else\n//!\n//! These methods combine the [`Some`] variants of two [`Option`] values:\n//!\n//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the\n//!   provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//! * [`zip_with`] calls the provided function `f` and returns\n//!   [`Some(f(s, o))`] if `self` is [`Some(s)`] and the provided\n//!   [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//!\n//! [`Some(f(s, o))`]: Some\n//! [`Some(o)`]: Some\n//! [`Some(s)`]: Some\n//! [`Some((s, o))`]: Some\n//! [`zip`]: Option::zip\n//! [`zip_with`]: Option::zip_with\n//!\n//! ## Boolean operators\n//!\n//! These methods treat the [`Option`] as a boolean value, where [`Some`]\n//! acts like [`true`] and [`None`] acts like [`false`]. There are two\n//! categories of these methods: ones that take an [`Option`] as input, and\n//! ones that take a function as input (to be lazily evaluated).\n//!\n//! The [`and`], [`or`], and [`xor`] methods take another [`Option`] as\n//! input, and produce an [`Option`] as output. Only the [`and`] method can\n//! produce an [`Option<U>`] value having a different inner type `U` than\n//! [`Option<T>`].\n//!\n//! | method  | self      | input     | output    |\n//! |---------|-----------|-----------|-----------|\n//! | [`and`] | `None`    | (ignored) | `None`    |\n//! | [`and`] | `Some(x)` | `None`    | `None`    |\n//! | [`and`] | `Some(x)` | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `None`    | `None`    | `None`    |\n//! | [`or`]  | `None`    | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `Some(x)` | (ignored) | `Some(x)` |\n//! | [`xor`] | `None`    | `None`    | `None`    |\n//! | [`xor`] | `None`    | `Some(y)` | `Some(y)` |\n//! | [`xor`] | `Some(x)` | `None`    | `Some(x)` |\n//! | [`xor`] | `Some(x)` | `Some(y)` | `None`    |\n//!\n//! [`and`]: Option::and\n//! [`or`]: Option::or\n//! [`xor`]: Option::xor\n//!\n//! The [`and_then`] and [`or_else`] methods take a function as input, and\n//! only evaluate the function when they need to produce a new value. Only\n//! the [`and_then`] method can produce an [`Option<U>`] value having a\n//! different inner type `U` than [`Option<T>`].\n//!\n//! | method       | self      | function input | function result | output    |\n//! |--------------|-----------|----------------|-----------------|-----------|\n//! | [`and_then`] | `None`    | (not provided) | (not evaluated) | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `None`          | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `None`    | (not provided) | `None`          | `None`    |\n//! | [`or_else`]  | `None`    | (not provided) | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `Some(x)` | (not provided) | (not evaluated) | `Some(x)` |\n//!\n//! [`and_then`]: Option::and_then\n//! [`or_else`]: Option::or_else\n//!\n//! This is an example of using methods like [`and_then`] and [`or`] in a\n//! pipeline of method calls. Early stages of the pipeline pass failure\n//! values ([`None`]) through unchanged, and continue processing on\n//! success values ([`Some`]). Toward the end, [`or`] substitutes an error\n//! message if it receives [`None`].\n//!\n//! ```\n//! # use std::collections::BTreeMap;\n//! let mut bt = BTreeMap::new();\n//! bt.insert(20u8, \"foo\");\n//! bt.insert(42u8, \"bar\");\n//! let res = [0u8, 1, 11, 200, 22]\n//!     .into_iter()\n//!     .map(|x| {\n//!         // `checked_sub()` returns `None` on error\n//!         x.checked_sub(1)\n//!             // same with `checked_mul()`\n//!             .and_then(|x| x.checked_mul(2))\n//!             // `BTreeMap::get` returns `None` on error\n//!             .and_then(|x| bt.get(&x))\n//!             // Substitute an error message if we have `None` so far\n//!             .or(Some(&\"error!\"))\n//!             .copied()\n//!             // Won't panic because we unconditionally used `Some` above\n//!             .unwrap()\n//!     })\n//!     .collect::<Vec<_>>();\n//! assert_eq!(res, [\"error!\", \"error!\", \"foo\", \"error!\", \"bar\"]);\n//! ```\n//!\n//! ## Comparison operators\n//!\n//! If `T` implements [`PartialOrd`] then [`Option<T>`] will derive its\n//! [`PartialOrd`] implementation.  With this order, [`None`] compares as\n//! less than any [`Some`], and two [`Some`] compare the same way as their\n//! contained values would in `T`.  If `T` also implements\n//! [`Ord`], then so does [`Option<T>`].\n//!\n//! ```\n//! assert!(None < Some(0));\n//! assert!(Some(0) < Some(1));\n//! ```\n//!\n//! ## Iterating over `Option`\n//!\n//! An [`Option`] can be iterated over. This can be helpful if you need an\n//! iterator that is conditionally empty. The iterator will either produce\n//! a single value (when the [`Option`] is [`Some`]), or produce no values\n//! (when the [`Option`] is [`None`]). For example, [`into_iter`] acts like\n//! [`once(v)`] if the [`Option`] is [`Some(v)`], and like [`empty()`] if\n//! the [`Option`] is [`None`].\n//!\n//! [`Some(v)`]: Some\n//! [`empty()`]: crate::iter::empty\n//! [`once(v)`]: crate::iter::once\n//!\n//! Iterators over [`Option<T>`] come in three types:\n//!\n//! * [`into_iter`] consumes the [`Option`] and produces the contained\n//!   value\n//! * [`iter`] produces an immutable reference of type `&T` to the\n//!   contained value\n//! * [`iter_mut`] produces a mutable reference of type `&mut T` to the\n//!   contained value\n//!\n//! [`into_iter`]: Option::into_iter\n//! [`iter`]: Option::iter\n//! [`iter_mut`]: Option::iter_mut\n//!\n//! An iterator over [`Option`] can be useful when chaining iterators, for\n//! example, to conditionally insert items. (It's not always necessary to\n//! explicitly call an iterator constructor: many [`Iterator`] methods that\n//! accept other iterators will also accept iterable types that implement\n//! [`IntoIterator`], which includes [`Option`].)\n//!\n//! ```\n//! let yep = Some(42);\n//! let nope = None;\n//! // chain() already calls into_iter(), so we don't have to do so\n//! let nums: Vec<i32> = (0..4).chain(yep).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 42, 4, 5, 6, 7]);\n//! let nums: Vec<i32> = (0..4).chain(nope).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 4, 5, 6, 7]);\n//! ```\n//!\n//! One reason to chain iterators in this way is that a function returning\n//! `impl Iterator` must have all possible return values be of the same\n//! concrete type. Chaining an iterated [`Option`] can help with that.\n//!\n//! ```\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types matching\n//!     match do_insert {\n//!         true => return (0..4).chain(Some(42)).chain(4..8),\n//!         false => return (0..4).chain(None).chain(4..8),\n//!     }\n//! }\n//! println!(\"{:?}\", make_iter(true).collect::<Vec<_>>());\n//! println!(\"{:?}\", make_iter(false).collect::<Vec<_>>());\n//! ```\n//!\n//! If we try to do the same thing, but using [`once()`] and [`empty()`],\n//! we can't return `impl Iterator` anymore because the concrete types of\n//! the return values differ.\n//!\n//! [`empty()`]: crate::iter::empty\n//! [`once()`]: crate::iter::once\n//!\n//! ```compile_fail,E0308\n//! # use std::iter::{empty, once};\n//! // This won't compile because all possible returns from the function\n//! // must have the same concrete type.\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types not matching\n//!     match do_insert {\n//!         true => return (0..4).chain(once(42)).chain(4..8),\n//!         false => return (0..4).chain(empty()).chain(4..8),\n//!     }\n//! }\n//! ```\n//!\n//! ## Collecting into `Option`\n//!\n//! [`Option`] implements the [`FromIterator`][impl-FromIterator] trait,\n//! which allows an iterator over [`Option`] values to be collected into an\n//! [`Option`] of a collection of each contained value of the original\n//! [`Option`] values, or [`None`] if any of the elements was [`None`].\n//!\n//! [impl-FromIterator]: Option#impl-FromIterator%3COption%3CA%3E%3E\n//!\n//! ```\n//! let v = [Some(2), Some(4), None, Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, None);\n//! let v = [Some(2), Some(4), Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, Some(vec![2, 4, 8]));\n//! ```\n//!\n//! [`Option`] also implements the [`Product`][impl-Product] and\n//! [`Sum`][impl-Sum] traits, allowing an iterator over [`Option`] values\n//! to provide the [`product`][Iterator::product] and\n//! [`sum`][Iterator::sum] methods.\n//!\n//! [impl-Product]: Option#impl-Product%3COption%3CU%3E%3E\n//! [impl-Sum]: Option#impl-Sum%3COption%3CU%3E%3E\n//!\n//! ```\n//! let v = [None, Some(1), Some(2), Some(3)];\n//! let res: Option<i32> = v.into_iter().sum();\n//! assert_eq!(res, None);\n//! let v = [Some(1), Some(2), Some(21)];\n//! let res: Option<i32> = v.into_iter().product();\n//! assert_eq!(res, Some(42));\n//! ```\n//!\n//! ## Modifying an [`Option`] in-place\n//!\n//! These methods return a mutable reference to the contained value of an\n//! [`Option<T>`]:\n//!\n//! * [`insert`] inserts a value, dropping any old contents\n//! * [`get_or_insert`] gets the current value, inserting a provided\n//!   default value if it is [`None`]\n//! * [`get_or_insert_default`] gets the current value, inserting the\n//!   default value of type `T` (which must implement [`Default`]) if it is\n//!   [`None`]\n//! * [`get_or_insert_with`] gets the current value, inserting a default\n//!   computed by the provided function if it is [`None`]\n//!\n//! [`get_or_insert`]: Option::get_or_insert\n//! [`get_or_insert_default`]: Option::get_or_insert_default\n//! [`get_or_insert_with`]: Option::get_or_insert_with\n//! [`insert`]: Option::insert\n//!\n//! These methods transfer ownership of the contained value of an\n//! [`Option`]:\n//!\n//! * [`take`] takes ownership of the contained value of an [`Option`], if\n//!   any, replacing the [`Option`] with [`None`]\n//! * [`replace`] takes ownership of the contained value of an [`Option`],\n//!   if any, replacing the [`Option`] with a [`Some`] containing the\n//!   provided value\n//!\n//! [`replace`]: Option::replace\n//! [`take`]: Option::take\n//!\n//! # Examples\n//!\n//! Basic pattern matching on [`Option`]:\n//!\n//! ```\n//! let msg = Some(\"howdy\");\n//!\n//! // Take a reference to the contained string\n//! if let Some(m) = &msg {\n//!     println!(\"{}\", *m);\n//! }\n//!\n//! // Remove the contained string, destroying the Option\n//! let unwrapped_msg = msg.unwrap_or(\"default message\");\n//! ```\n//!\n//! Initialize a result to [`None`] before a loop:\n//!\n//! ```\n//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }\n//!\n//! // A list of data to search through.\n//! let all_the_big_things = [\n//!     Kingdom::Plant(250, \"redwood\"),\n//!     Kingdom::Plant(230, \"noble fir\"),\n//!     Kingdom::Plant(229, \"sugar pine\"),\n//!     Kingdom::Animal(25, \"blue whale\"),\n//!     Kingdom::Animal(19, \"fin whale\"),\n//!     Kingdom::Animal(15, \"north pacific right whale\"),\n//! ];\n//!\n//! // We're going to search for the name of the biggest animal,\n//! // but to start with we've just got `None`.\n//! let mut name_of_biggest_animal = None;\n//! let mut size_of_biggest_animal = 0;\n//! for big_thing in &all_the_big_things {\n//!     match *big_thing {\n//!         Kingdom::Animal(size, name) if size > size_of_biggest_animal => {\n//!             // Now we've found the name of some big animal\n//!             size_of_biggest_animal = size;\n//!             name_of_biggest_animal = Some(name);\n//!         }\n//!         Kingdom::Animal(..) | Kingdom::Plant(..) => ()\n//!     }\n//! }\n//!\n//! match name_of_biggest_animal {\n//!     Some(name) => println!(\"the biggest animal is {name}\"),\n//!     None => println!(\"there are no animals :(\"),\n//! }\n//! ```\n\n#![stable(feature = \"rust1\", since = \"1.0.0\")]\n\nuse crate::iter::{self, FromIterator, FusedIterator, TrustedLen};\nuse crate::marker::Destruct;\nuse crate::panicking::{panic, panic_str};\nuse crate::pin::Pin;\nuse crate::{\n    convert, hint, mem,\n    ops::{self, ControlFlow, Deref, DerefMut},\n};\n\n/// The `Option` type. See [the module level documentation](self) for more.\n#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]\n#[rustc_diagnostic_item = \"Option\"]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub enum Option<T> {\n    /// No value.\n    #[lang = \"None\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    None,\n    /// Some value of type `T`.\n    #[lang = \"Some\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    Some(#[stable(feature = \"rust1\", since = \"1.0.0\")] T),\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Type implementation\n/////////////////////////////////////////////////////////////////////////////\n\nimpl<T> Option<T> {\n    /////////////////////////////////////////////////////////////////////////\n    // Querying the contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns `true` if the option is a [`Some`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some(), true);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some(), false);\n    /// ```\n    #[must_use = \"if you intended to assert that this has a value, consider `.unwrap()` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_some(&self) -> bool {\n        matches!(*self, Some(_))\n    }\n\n    /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(is_some_with)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), true);\n    ///\n    /// let x: Option<u32> = Some(0);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"is_some_with\", issue = \"93050\")]\n    pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool {\n        matches!(self, Some(x) if f(x))\n    }\n\n    /// Returns `true` if the option is a [`None`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_none(), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_none(), true);\n    /// ```\n    #[must_use = \"if you intended to assert that this doesn't have a value, consider \\\n                  `.and_then(|_| panic!(\\\"`Option` had a value when expected `None`\\\"))` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_none(&self) -> bool {\n        !self.is_some()\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Adapter for working with references\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `as_ref` to first take an `Option` to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let text: Option<String> = Some(\"Hello, world!\".to_string());\n    /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,\n    /// // then consume *that* with `map`, leaving `text` on the stack.\n    /// let text_length: Option<usize> = text.as_ref().map(|s| s.len());\n    /// println!(\"still can print text: {text:?}\");\n    /// ```\n    #[inline]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn as_ref(&self) -> Option<&T> {\n        match *self {\n            Some(ref x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// match x.as_mut() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn as_mut(&mut self) -> Option<&mut T> {\n        match *self {\n            Some(ref mut x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&]Option\\<T>></code> to <code>Option<[Pin]<[&]T>></code>.\n    ///\n    /// [&]: reference \"shared reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {\n        match Pin::get_ref(self).as_ref() {\n            // SAFETY: `x` is guaranteed to be pinned because it comes from `self`\n            // which is pinned.\n            Some(x) => unsafe { Some(Pin::new_unchecked(x)) },\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&mut] Option\\<T>></code> to <code>Option<[Pin]<[&mut] T>></code>.\n    ///\n    /// [&mut]: reference \"mutable reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {\n        // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.\n        // `x` is guaranteed to be pinned because it comes from `self` which is pinned.\n        unsafe {\n            match Pin::get_unchecked_mut(self).as_mut() {\n                Some(x) => Some(Pin::new_unchecked(x)),\n                None => None,\n            }\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Getting to contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the value is a [`None`] with a custom panic message provided by\n    /// `msg`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"value\");\n    /// assert_eq!(x.expect(\"fruits are healthy\"), \"value\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// x.expect(\"fruits are healthy\"); // panics with `fruits are healthy`\n    /// ```\n    ///\n    /// # Recommended Message Style\n    ///\n    /// We recommend that `expect` messages are used to describe the reason you\n    /// _expect_ the `Option` should be `Some`.\n    ///\n    /// ```should_panic\n    /// # let slice: &[u8] = &[];\n    /// let item = slice.get(0)\n    ///     .expect(\"slice should not be empty\");\n    /// ```\n    ///\n    /// **Hint**: If you're having trouble remembering how to phrase expect\n    /// error messages remember to focus on the word \"should\" as in \"env\n    /// variable should be set by blah\" or \"the given binary should be available\n    /// and executable by the current user\".\n    ///\n    /// For more detail on expect message styles and the reasoning behind our\n    /// recommendation please refer to the section on [\"Common Message\n    /// Styles\"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs.\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn expect(self, msg: &str) -> T {\n        match self {\n            Some(val) => val,\n            None => expect_failed(msg),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// Because this function may panic, its use is generally discouraged.\n    /// Instead, prefer to use pattern matching and handle the [`None`]\n    /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or\n    /// [`unwrap_or_default`].\n    ///\n    /// [`unwrap_or`]: Option::unwrap_or\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    /// [`unwrap_or_default`]: Option::unwrap_or_default\n    ///\n    /// # Panics\n    ///\n    /// Panics if the self value equals [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(x.unwrap(), \"air\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.unwrap(), \"air\"); // fails\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn unwrap(self) -> T {\n        match self {\n            Some(val) => val,\n            None => panic(\"called `Option::unwrap()` on a `None` value\"),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a provided default.\n    ///\n    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`unwrap_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// assert_eq!(Some(\"car\").unwrap_or(\"bike\"), \"car\");\n    /// assert_eq!(None.unwrap_or(\"bike\"), \"bike\");\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or(self, default: T) -> T\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => default,\n        }\n    }\n\n    /// Returns the contained [`Some`] value or computes it from a closure.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 10;\n    /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);\n    /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_else<F>(self, f: F) -> T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => f(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a default.\n    ///\n    /// Consumes the `self` argument then, if [`Some`], returns the contained\n    /// value, otherwise if [`None`], returns the [default value] for that\n    /// type.\n    ///\n    /// # Examples\n    ///\n    /// Converts a string to an integer, turning poorly-formed strings\n    /// into 0 (the default value for integers). [`parse`] converts\n    /// a string to any other type that implements [`FromStr`], returning\n    /// [`None`] on error.\n    ///\n    /// ```\n    /// let good_year_from_input = \"1909\";\n    /// let bad_year_from_input = \"190blarg\";\n    /// let good_year = good_year_from_input.parse().ok().unwrap_or_default();\n    /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();\n    ///\n    /// assert_eq!(1909, good_year);\n    /// assert_eq!(0, bad_year);\n    /// ```\n    ///\n    /// [default value]: Default::default\n    /// [`parse`]: str::parse\n    /// [`FromStr`]: crate::str::FromStr\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_default(self) -> T\n    where\n        T: ~const Default,\n    {\n        match self {\n            Some(x) => x,\n            None => Default::default(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value,\n    /// without checking that the value is not [`None`].\n    ///\n    /// # Safety\n    ///\n    /// Calling this method on [`None`] is *[undefined behavior]*.\n    ///\n    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\");\n    /// ```\n    ///\n    /// ```no_run\n    /// let x: Option<&str> = None;\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\"); // Undefined behavior!\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"option_result_unwrap_unchecked\", since = \"1.58.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const unsafe fn unwrap_unchecked(self) -> T {\n        debug_assert!(self.is_some());\n        match self {\n            Some(val) => val,\n            // SAFETY: the safety contract must be upheld by the caller.\n            None => unsafe { hint::unreachable_unchecked() },\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Transforming contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming\n    /// the original:\n    ///\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    /// ```\n    /// let maybe_some_string = Some(String::from(\"Hello, World!\"));\n    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`\n    /// let maybe_some_len = maybe_some_string.map(|s| s.len());\n    ///\n    /// assert_eq!(maybe_some_len, Some(13));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(f(x)),\n            None => None,\n        }\n    }\n\n    /// Calls the provided closure with a reference to the contained value (if [`Some`]).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(result_option_inspect)]\n    ///\n    /// let v = vec![1, 2, 3, 4, 5];\n    ///\n    /// // prints \"got: 4\"\n    /// let x: Option<&usize> = v.get(3).inspect(|x| println!(\"got: {x}\"));\n    ///\n    /// // prints nothing\n    /// let x: Option<&usize> = v.get(5).inspect(|x| println!(\"got: {x}\"));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"result_option_inspect\", issue = \"91345\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn inspect<F>(self, f: F) -> Self\n    where\n        F: ~const FnOnce(&T),\n        F: ~const Destruct,\n    {\n        if let Some(ref x) = self {\n            f(x);\n        }\n\n        self\n    }\n\n    /// Returns the provided default result (if none),\n    /// or applies a function to the contained value (if any).\n    ///\n    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`map_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`map_or_else`]: Option::map_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or(42, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or(42, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or<U, F>(self, default: U, f: F) -> U\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default,\n        }\n    }\n\n    /// Computes a default function result (if none), or\n    /// applies a different function to the contained value (if any).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 21;\n    ///\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U\n    where\n        D: ~const FnOnce() -> U,\n        D: ~const Destruct,\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default(),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err)`].\n    ///\n    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`ok_or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err)`]: Err\n    /// [`Some(v)`]: Some\n    /// [`ok_or_else`]: Option::ok_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or(0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or(0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or<E>(self, err: E) -> Result<T, E>\n    where\n        E: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err())`].\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err())`]: Err\n    /// [`Some(v)`]: Some\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or_else(|| 0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or_else(|| 0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>\n    where\n        F: ~const FnOnce() -> E,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err()),\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.\n    ///\n    /// Leaves the original Option in-place, creating a new one with a reference\n    /// to the original one, additionally coercing the contents via [`Deref`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref(), Some(\"hey\"));\n    ///\n    /// let x: Option<String> = None;\n    /// assert_eq!(x.as_deref(), None);\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref(&self) -> Option<&T::Target>\n    where\n        T: ~const Deref,\n    {\n        match self.as_ref() {\n            Some(t) => Some(t.deref()),\n            None => None,\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.\n    ///\n    /// Leaves the original `Option` in-place, creating a new one containing a mutable reference to\n    /// the inner type's [`Deref::Target`] type.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref_mut().map(|x| {\n    ///     x.make_ascii_uppercase();\n    ///     x\n    /// }), Some(\"HEY\".to_owned().as_mut_str()));\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>\n    where\n        T: ~const DerefMut,\n    {\n        match self.as_mut() {\n            Some(t) => Some(t.deref_mut()),\n            None => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Iterator constructors\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns an iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(4);\n    /// assert_eq!(x.iter().next(), Some(&4));\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.iter().next(), None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn iter(&self) -> Iter<'_, T> {\n        Iter { inner: Item { opt: self.as_ref() } }\n    }\n\n    /// Returns a mutable iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(4);\n    /// match x.iter_mut().next() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// assert_eq!(x.iter_mut().next(), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub fn iter_mut(&mut self) -> IterMut<'_, T> {\n        IterMut { inner: Item { opt: self.as_mut() } }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Boolean operations on the values, eager and lazy\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns [`None`] if the option is [`None`], otherwise returns `optb`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x = Some(2);\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), Some(\"foo\"));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and<U>(self, optb: Option<U>) -> Option<U>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(_) => optb,\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `f` with the\n    /// wrapped value and returns the result.\n    ///\n    /// Some languages call this operation flatmap.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn sq_then_to_string(x: u32) -> Option<String> {\n    ///     x.checked_mul(x).map(|sq| sq.to_string())\n    /// }\n    ///\n    /// assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string()));\n    /// assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed!\n    /// assert_eq!(None.and_then(sq_then_to_string), None);\n    /// ```\n    ///\n    /// Often used to chain fallible operations that may return [`None`].\n    ///\n    /// ```\n    /// let arr_2d = [[\"A0\", \"A1\"], [\"B0\", \"B1\"]];\n    ///\n    /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1));\n    /// assert_eq!(item_0_1, Some(&\"A1\"));\n    ///\n    /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));\n    /// assert_eq!(item_2_0, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and_then<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> Option<U>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => f(x),\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `predicate`\n    /// with the wrapped value and returns:\n    ///\n    /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped\n    ///   value), and\n    /// - [`None`] if `predicate` returns `false`.\n    ///\n    /// This function works similar to [`Iterator::filter()`]. You can imagine\n    /// the `Option<T>` being an iterator over one or zero elements. `filter()`\n    /// lets you decide which elements to keep.\n    ///\n    /// # Examples\n    ///\n    /// ```rust\n    /// fn is_even(n: &i32) -> bool {\n    ///     n % 2 == 0\n    /// }\n    ///\n    /// assert_eq!(None.filter(is_even), None);\n    /// assert_eq!(Some(3).filter(is_even), None);\n    /// assert_eq!(Some(4).filter(is_even), Some(4));\n    /// ```\n    ///\n    /// [`Some(t)`]: Some\n    #[inline]\n    #[stable(feature = \"option_filter\", since = \"1.27.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn filter<P>(self, predicate: P) -> Self\n    where\n        T: ~const Destruct,\n        P: ~const FnOnce(&T) -> bool,\n        P: ~const Destruct,\n    {\n        if let Some(x) = self {\n            if predicate(&x) {\n                return Some(x);\n            }\n        }\n        None\n    }\n\n    /// Returns the option if it contains a value, otherwise returns `optb`.\n    ///\n    /// Arguments passed to `or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`or_else`]: Option::or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y = None;\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x = None;\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(100));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = None;\n    /// assert_eq!(x.or(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => optb,\n        }\n    }\n\n    /// Returns the option if it contains a value, otherwise calls `f` and\n    /// returns the result.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn nobody() -> Option<&'static str> { None }\n    /// fn vikings() -> Option<&'static str> { Some(\"vikings\") }\n    ///\n    /// assert_eq!(Some(\"barbarians\").or_else(vikings), Some(\"barbarians\"));\n    /// assert_eq!(None.or_else(vikings), Some(\"vikings\"));\n    /// assert_eq!(None.or_else(nobody), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or_else<F>(self, f: F) -> Option<T>\n    where\n        F: ~const FnOnce() -> Option<T>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => f(),\n        }\n    }\n\n    /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_xor\", since = \"1.37.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn xor(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match (self, optb) {\n            (Some(a), None) => Some(a),\n            (None, Some(b)) => Some(b),\n            _ => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Entry-like operations to insert a value and return a reference\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Inserts `value` into the option, then returns a mutable reference to it.\n    ///\n    /// If the option already contains a value, the old value is dropped.\n    ///\n    /// See also [`Option::get_or_insert`], which doesn't update the value if\n    /// the option already contains [`Some`].\n    ///\n    /// # Example\n    ///\n    /// ```\n    /// let mut opt = None;\n    /// let val = opt.insert(1);\n    /// assert_eq!(*val, 1);\n    /// assert_eq!(opt.unwrap(), 1);\n    /// let val = opt.insert(2);\n    /// assert_eq!(*val, 2);\n    /// *val = 3;\n    /// assert_eq!(opt.unwrap(), 3);\n    /// ```\n    #[must_use = \"if you intended to set a value, consider assignment instead\"]\n    #[inline]\n    #[stable(feature = \"option_insert\", since = \"1.53.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        *self = Some(value);\n\n        // SAFETY: the code above just filled the option\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts `value` into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// See also [`Option::insert`], which updates the value even if\n    /// the option already contains [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert(5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        if let None = *self {\n            *self = Some(value);\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts the default value into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_get_or_insert_default)]\n    ///\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_default();\n    ///     assert_eq!(y, &0);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"option_get_or_insert_default\", issue = \"82901\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_default(&mut self) -> &mut T\n    where\n        T: ~const Default,\n    {\n        const fn default<T: ~const Default>() -> T {\n            T::default()\n        }\n\n        self.get_or_insert_with(default)\n    }\n\n    /// Inserts a value computed from `f` into the option if it is [`None`],\n    /// then returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        if let None = *self {\n            // the compiler isn't smart enough to know that we are not dropping a `T`\n            // here and wants us to ensure `T` can be dropped at compile time.\n            mem::forget(mem::replace(self, Some(f())))\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Misc\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Takes the value out of the option, leaving a [`None`] in its place.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, Some(2));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn take(&mut self) -> Option<T> {\n        // FIXME replace `mem::replace` by `mem::take` when the latter is const ready\n        mem::replace(self, None)\n    }\n\n    /// Replaces the actual value in the option by the value given in parameter,\n    /// returning the old value if present,\n    /// leaving a [`Some`] in its place without deinitializing either one.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let old = x.replace(5);\n    /// assert_eq!(x, Some(5));\n    /// assert_eq!(old, Some(2));\n    ///\n    /// let mut x = None;\n    /// let old = x.replace(3);\n    /// assert_eq!(x, Some(3));\n    /// assert_eq!(old, None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"option_replace\", since = \"1.31.0\")]\n    pub const fn replace(&mut self, value: T) -> Option<T> {\n        mem::replace(self, Some(value))\n    }\n\n    /// Returns `true` if the option is a [`Some`] value containing the given value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_result_contains)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.contains(&2), true);\n    ///\n    /// let x: Option<u32> = Some(3);\n    /// assert_eq!(x.contains(&2), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.contains(&2), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"option_result_contains\", issue = \"62358\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn contains<U>(&self, x: &U) -> bool\n    where\n        U: ~const PartialEq<T>,\n    {\n        match self {\n            Some(y) => x.eq(y),\n            None => false,\n        }\n    }\n\n    /// Zips `self` with another `Option`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(1);\n    /// let y = Some(\"hi\");\n    /// let z = None::<u8>;\n    ///\n    /// assert_eq!(x.zip(y), Some((1, \"hi\")));\n    /// assert_eq!(x.zip(z), None);\n    /// ```\n    #[stable(feature = \"option_zip_option\", since = \"1.46.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some((a, b)),\n            _ => None,\n        }\n    }\n\n    /// Zips `self` and another `Option` with function `f`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_zip)]\n    ///\n    /// #[derive(Debug, PartialEq)]\n    /// struct Point {\n    ///     x: f64,\n    ///     y: f64,\n    /// }\n    ///\n    /// impl Point {\n    ///     fn new(x: f64, y: f64) -> Self {\n    ///         Self { x, y }\n    ///     }\n    /// }\n    ///\n    /// let x = Some(17.5);\n    /// let y = Some(42.7);\n    ///\n    /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 }));\n    /// assert_eq!(x.zip_with(None, Point::new), None);\n    /// ```\n    #[unstable(feature = \"option_zip\", issue = \"70086\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>\n    where\n        F: ~const FnOnce(T, U) -> R,\n        F: ~const Destruct,\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some(f(a, b)),\n            _ => None,\n        }\n    }\n}\n\nimpl<T, U> Option<(T, U)> {\n    /// Unzips an option containing a tuple of two options.\n    ///\n    /// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.\n    /// Otherwise, `(None, None)` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(unzip_option)]\n    ///\n    /// let x = Some((1, \"hi\"));\n    /// let y = None::<(u8, u32)>;\n    ///\n    /// assert_eq!(x.unzip(), (Some(1), Some(\"hi\")));\n    /// assert_eq!(y.unzip(), (None, None));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"unzip_option\", issue = \"87800\", reason = \"recently added\")]\n    pub const fn unzip(self) -> (Option<T>, Option<U>) {\n        match self {\n            Some((a, b)) => (Some(a), Some(b)),\n            None => (None, None),\n        }\n    }\n}\n\nimpl<T> Option<&T> {\n    /// Maps an `Option<&T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        // FIXME: this implementation, which sidesteps using `Option::map` since it's not const\n        // ready yet, should be reverted when possible to avoid code repetition\n        match self {\n            Some(&v) => Some(v),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T> Option<&mut T> {\n    /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        match self {\n            Some(&mut t) => Some(t),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(since = \"1.26.0\", feature = \"option_ref_mut_cloned\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T, E> Option<Result<T, E>> {\n    /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.\n    ///\n    /// [`None`] will be mapped to <code>[Ok]\\([None])</code>.\n    /// <code>[Some]\\([Ok]\\(\\_))</code> and <code>[Some]\\([Err]\\(\\_))</code> will be mapped to\n    /// <code>[Ok]\\([Some]\\(\\_))</code> and <code>[Err]\\(\\_)</code>.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #[derive(Debug, Eq, PartialEq)]\n    /// struct SomeErr;\n    ///\n    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));\n    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));\n    /// assert_eq!(x, y.transpose());\n    /// ```\n    #[inline]\n    #[stable(feature = \"transpose_result\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn transpose(self) -> Result<Option<T>, E> {\n        match self {\n            Some(Ok(x)) => Ok(Some(x)),\n            Some(Err(e)) => Err(e),\n            None => Ok(None),\n        }\n    }\n}\n\n// This is a separate function to reduce the code size of .expect() itself.\n#[cfg_attr(not(feature = \"panic_immediate_abort\"), inline(never))]\n#[cfg_attr(feature = \"panic_immediate_abort\", inline)]\n#[cold]\n#[track_caller]\n#[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\nconst fn expect_failed(msg: &str) -> ! {\n    panic_str(msg)\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Trait implementations\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_clone\", issue = \"91805\")]\nimpl<T> const Clone for Option<T>\nwhere\n    T: ~const Clone + ~const Destruct,\n{\n    #[inline]\n    fn clone(&self) -> Self {\n        match self {\n            Some(x) => Some(x.clone()),\n            None => None,\n        }\n    }\n\n    #[inline]\n    fn clone_from(&mut self, source: &Self) {\n        match (self, source) {\n            (Some(to), Some(from)) => to.clone_from(from),\n            (to, from) => *to = from.clone(),\n        }\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_default_impls\", issue = \"87864\")]\nimpl<T> const Default for Option<T> {\n    /// Returns [`None`][Option::None].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let opt: Option<u32> = Option::default();\n    /// assert!(opt.is_none());\n    /// ```\n    #[inline]\n    fn default() -> Option<T> {\n        None\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<T> IntoIterator for Option<T> {\n    type Item = T;\n    type IntoIter = IntoIter<T>;\n\n    /// Returns a consuming iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"string\");\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert_eq!(v, [\"string\"]);\n    ///\n    /// let x = None;\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert!(v.is_empty());\n    /// ```\n    #[inline]\n    fn into_iter(self) -> IntoIter<T> {\n        IntoIter { inner: Item { opt: self } }\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a Option<T> {\n    type Item = &'a T;\n    type IntoIter = Iter<'a, T>;\n\n    fn into_iter(self) -> Iter<'a, T> {\n        self.iter()\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a mut Option<T> {\n    type Item = &'a mut T;\n    type IntoIter = IterMut<'a, T>;\n\n    fn into_iter(self) -> IterMut<'a, T> {\n        self.iter_mut()\n    }\n}\n\n#[stable(since = \"1.12.0\", feature = \"option_from\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const From<T> for Option<T> {\n    /// Moves `val` into a new [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let o: Option<u8> = Option::from(67);\n    ///\n    /// assert_eq!(Some(67), o);\n    /// ```\n    fn from(val: T) -> Option<T> {\n        Some(val)\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a Option<T>> for Option<&'a T> {\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>[Option]<[String]></code> into an <code>[Option]<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `from` to first take an [`Option`] to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let s: Option<String> = Some(String::from(\"Hello, Rustaceans!\"));\n    /// let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());\n    ///\n    /// println!(\"Can still print s: {s:?}\");\n    ///\n    /// assert_eq!(o, Some(18));\n    /// ```\n    fn from(o: &'a Option<T>) -> Option<&'a T> {\n        o.as_ref()\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut s = Some(String::from(\"Hello\"));\n    /// let o: Option<&mut String> = Option::from(&mut s);\n    ///\n    /// match o {\n    ///     Some(t) => *t = String::from(\"Hello, Rustaceans!\"),\n    ///     None => (),\n    /// }\n    ///\n    /// assert_eq!(s, Some(String::from(\"Hello, Rustaceans!\")));\n    /// ```\n    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {\n        o.as_mut()\n    }\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// The Option Iterators\n/////////////////////////////////////////////////////////////////////////////\n\n#[derive(Clone, Debug)]\nstruct Item<A> {\n    opt: Option<A>,\n}\n\nimpl<A> Iterator for Item<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        match self.opt {\n            Some(_) => (1, Some(1)),\n            None => (0, Some(0)),\n        }\n    }\n}\n\nimpl<A> DoubleEndedIterator for Item<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n}\n\nimpl<A> ExactSizeIterator for Item<A> {}\nimpl<A> FusedIterator for Item<A> {}\nunsafe impl<A> TrustedLen for Item<A> {}\n\n/// An iterator over a reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct Iter<'a, A: 'a> {\n    inner: Item<&'a A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for Iter<'a, A> {\n    type Item = &'a A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for Iter<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for Iter<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for Iter<'_, A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for Iter<'_, A> {}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Clone for Iter<'_, A> {\n    #[inline]\n    fn clone(&self) -> Self {\n        Iter { inner: self.inner.clone() }\n    }\n}\n\n/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter_mut`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct IterMut<'a, A: 'a> {\n    inner: Item<&'a mut A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for IterMut<'a, A> {\n    type Item = &'a mut A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a mut A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for IterMut<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a mut A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IterMut<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IterMut<'_, A> {}\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IterMut<'_, A> {}\n\n/// An iterator over the value in [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::into_iter`] function.\n#[derive(Clone, Debug)]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub struct IntoIter<A> {\n    inner: Item<A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Iterator for IntoIter<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> DoubleEndedIterator for IntoIter<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IntoIter<A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IntoIter<A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IntoIter<A> {}\n\n/////////////////////////////////////////////////////////////////////////////\n// FromIterator\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {\n    /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],\n    /// no further elements are taken, and the [`None`][Option::None] is\n    /// returned. Should no [`None`][Option::None] occur, a container of type\n    /// `V` containing the values of each [`Option`] is returned.\n    ///\n    /// # Examples\n    ///\n    /// Here is an example which increments every integer in a vector.\n    /// We use the checked variant of `add` that returns `None` when the\n    /// calculation would result in an overflow.\n    ///\n    /// ```\n    /// let items = vec![0_u16, 1, 2];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_add(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, Some(vec![1, 2, 3]));\n    /// ```\n    ///\n    /// As you can see, this will return the expected, valid items.\n    ///\n    /// Here is another example that tries to subtract one from another list\n    /// of integers, this time checking for underflow:\n    ///\n    /// ```\n    /// let items = vec![2_u16, 1, 0];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_sub(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// ```\n    ///\n    /// Since the last element is zero, it would underflow. Thus, the resulting\n    /// value is `None`.\n    ///\n    /// Here is a variation on the previous example, showing that no\n    /// further elements are taken from `iter` after the first `None`.\n    ///\n    /// ```\n    /// let items = vec![3_u16, 2, 1, 10];\n    ///\n    /// let mut shared = 0;\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| { shared += x; x.checked_sub(2) })\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// assert_eq!(shared, 6);\n    /// ```\n    ///\n    /// Since the third element caused an underflow, no further elements were taken,\n    /// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.\n    #[inline]\n    fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {\n        // FIXME(#11084): This could be replaced with Iterator::scan when this\n        // performance bug is closed.\n\n        iter::try_process(iter.into_iter(), |i| i.collect())\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::Try for Option<T> {\n    type Output = T;\n    type Residual = Option<convert::Infallible>;\n\n    #[inline]\n    fn from_output(output: Self::Output) -> Self {\n        Some(output)\n    }\n\n    #[inline]\n    fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n        match self {\n            Some(v) => ControlFlow::Continue(v),\n            None => ControlFlow::Break(None),\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::FromResidual for Option<T> {\n    #[inline]\n    fn from_residual(residual: Option<convert::Infallible>) -> Self {\n        match residual {\n            None => None,\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_yeet\", issue = \"96374\")]\nimpl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {\n    #[inline]\n    fn from_residual(ops::Yeet(()): ops::Yeet<()>) -> Self {\n        None\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_residual\", issue = \"91285\")]\nimpl<T> ops::Residual<T> for Option<convert::Infallible> {\n    type TryType = Option<T>;\n}\n\nimpl<T> Option<Option<T>> {\n    /// Converts from `Option<Option<T>>` to `Option<T>`.\n    ///\n    /// # Examples\n    ///\n    /// Basic usage:\n    ///\n    /// ```\n    /// let x: Option<Option<u32>> = Some(Some(6));\n    /// assert_eq!(Some(6), x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = Some(None);\n    /// assert_eq!(None, x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = None;\n    /// assert_eq!(None, x.flatten());\n    /// ```\n    ///\n    /// Flattening only removes one level of nesting at a time:\n    ///\n    /// ```\n    /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));\n    /// assert_eq!(Some(Some(6)), x.flatten());\n    /// assert_eq!(Some(6), x.flatten().flatten());\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_flattening\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn flatten(self) -> Option<T> {\n        match self {\n            Some(inner) => inner,\n            None => None,\n        }\n    }\n}\n","uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","version":0}
17:00:16 INFO unnamed src/language_server_protocol.rs:1888 text_document_code_lens; params=Object({"bufnr": Number(2), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})})
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:command","params":["setlocal omnifunc=LanguageClient#complete"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","LanguageClient_projectRoot","/home/dick/LanguageClient-neovim"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ExecuteAutocmd","params":["LanguageClientTextDocumentDidOpenPost"]}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"//! Optional values.\n//!\n//! Type [`Option`] represents an optional value: every [`Option`]\n//! is either [`Some`] and contains a value, or [`None`], and\n//! does not. [`Option`] types are very common in Rust code, as\n//! they have a number of uses:\n//!\n//! * Initial values\n//! * Return values for functions that are not defined\n//!   over their entire input range (partial functions)\n//! * Return value for otherwise reporting simple errors, where [`None`] is\n//!   returned on error\n//! * Optional struct fields\n//! * Struct fields that can be loaned or \"taken\"\n//! * Optional function arguments\n//! * Nullable pointers\n//! * Swapping things out of difficult situations\n//!\n//! [`Option`]s are commonly paired with pattern matching to query the presence\n//! of a value and take action, always accounting for the [`None`] case.\n//!\n//! ```\n//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {\n//!     if denominator == 0.0 {\n//!         None\n//!     } else {\n//!         Some(numerator / denominator)\n//!     }\n//! }\n//!\n//! // The return value of the function is an option\n//! let result = divide(2.0, 3.0);\n//!\n//! // Pattern match to retrieve the value\n//! match result {\n//!     // The division was valid\n//!     Some(x) => println!(\"Result: {x}\"),\n//!     // The division was invalid\n//!     None    => println!(\"Cannot divide by 0\"),\n//! }\n//! ```\n//!\n//\n// FIXME: Show how `Option` is used in practice, with lots of methods\n//\n//! # Options and pointers (\"nullable\" pointers)\n//!\n//! Rust's pointer types must always point to a valid location; there are\n//! no \"null\" references. Instead, Rust has *optional* pointers, like\n//! the optional owned box, <code>[Option]<[Box\\<T>]></code>.\n//!\n//! [Box\\<T>]: ../../std/boxed/struct.Box.html\n//!\n//! The following example uses [`Option`] to create an optional box of\n//! [`i32`]. Notice that in order to use the inner [`i32`] value, the\n//! `check_optional` function first needs to use pattern matching to\n//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or\n//! not ([`None`]).\n//!\n//! ```\n//! let optional = None;\n//! check_optional(optional);\n//!\n//! let optional = Some(Box::new(9000));\n//! check_optional(optional);\n//!\n//! fn check_optional(optional: Option<Box<i32>>) {\n//!     match optional {\n//!         Some(p) => println!(\"has value {p}\"),\n//!         None => println!(\"has no value\"),\n//!     }\n//! }\n//! ```\n//!\n//! # Representation\n//!\n//! Rust guarantees to optimize the following types `T` such that\n//! [`Option<T>`] has the same size as `T`:\n//!\n//! * [`Box<U>`]\n//! * `&U`\n//! * `&mut U`\n//! * `fn`, `extern \"C\" fn`[^extern_fn]\n//! * [`num::NonZero*`]\n//! * [`ptr::NonNull<U>`]\n//! * `#[repr(transparent)]` struct around one of the types in this list.\n//!\n//! [^extern_fn]: this remains true for any other ABI: `extern \"abi\" fn` (_e.g._, `extern \"system\" fn`)\n//!\n//! [`Box<U>`]: ../../std/boxed/struct.Box.html\n//! [`num::NonZero*`]: crate::num\n//! [`ptr::NonNull<U>`]: crate::ptr::NonNull\n//!\n//! This is called the \"null pointer optimization\" or NPO.\n//!\n//! It is further guaranteed that, for the cases above, one can\n//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and\n//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`\n//! is undefined behaviour).\n//!\n//! # Method overview\n//!\n//! In addition to working with pattern matching, [`Option`] provides a wide\n//! variety of different methods.\n//!\n//! ## Querying the variant\n//!\n//! The [`is_some`] and [`is_none`] methods return [`true`] if the [`Option`]\n//! is [`Some`] or [`None`], respectively.\n//!\n//! [`is_none`]: Option::is_none\n//! [`is_some`]: Option::is_some\n//!\n//! ## Adapters for working with references\n//!\n//! * [`as_ref`] converts from <code>[&][][Option]\\<T></code> to <code>[Option]<[&]T></code>\n//! * [`as_mut`] converts from <code>[&mut] [Option]\\<T></code> to <code>[Option]<[&mut] T></code>\n//! * [`as_deref`] converts from <code>[&][][Option]\\<T></code> to\n//!   <code>[Option]<[&]T::[Target]></code>\n//! * [`as_deref_mut`] converts from <code>[&mut] [Option]\\<T></code> to\n//!   <code>[Option]<[&mut] T::[Target]></code>\n//! * [`as_pin_ref`] converts from <code>[Pin]<[&][][Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&]T>></code>\n//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\\<T>></code> to\n//!   <code>[Option]<[Pin]<[&mut] T>></code>\n//!\n//! [&]: reference \"shared reference\"\n//! [&mut]: reference \"mutable reference\"\n//! [Target]: Deref::Target \"ops::Deref::Target\"\n//! [`as_deref`]: Option::as_deref\n//! [`as_deref_mut`]: Option::as_deref_mut\n//! [`as_mut`]: Option::as_mut\n//! [`as_pin_mut`]: Option::as_pin_mut\n//! [`as_pin_ref`]: Option::as_pin_ref\n//! [`as_ref`]: Option::as_ref\n//!\n//! ## Extracting the contained value\n//!\n//! These methods extract the contained value in an [`Option<T>`] when it\n//! is the [`Some`] variant. If the [`Option`] is [`None`]:\n//!\n//! * [`expect`] panics with a provided custom message\n//! * [`unwrap`] panics with a generic message\n//! * [`unwrap_or`] returns the provided default value\n//! * [`unwrap_or_default`] returns the default value of the type `T`\n//!   (which must implement the [`Default`] trait)\n//! * [`unwrap_or_else`] returns the result of evaluating the provided\n//!   function\n//!\n//! [`expect`]: Option::expect\n//! [`unwrap`]: Option::unwrap\n//! [`unwrap_or`]: Option::unwrap_or\n//! [`unwrap_or_default`]: Option::unwrap_or_default\n//! [`unwrap_or_else`]: Option::unwrap_or_else\n//!\n//! ## Transforming contained values\n//!\n//! These methods transform [`Option`] to [`Result`]:\n//!\n//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   [`Err(err)`] using the provided default `err` value\n//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to\n//!   a value of [`Err`] using the provided function\n//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a\n//!   [`Result`] of an [`Option`]\n//!\n//! [`Err(err)`]: Err\n//! [`Ok(v)`]: Ok\n//! [`Some(v)`]: Some\n//! [`ok_or`]: Option::ok_or\n//! [`ok_or_else`]: Option::ok_or_else\n//! [`transpose`]: Option::transpose\n//!\n//! These methods transform the [`Some`] variant:\n//!\n//! * [`filter`] calls the provided predicate function on the contained\n//!   value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]\n//!   if the function returns `true`; otherwise, returns [`None`]\n//! * [`flatten`] removes one level of nesting from an\n//!   [`Option<Option<T>>`]\n//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the\n//!   provided function to the contained value of [`Some`] and leaving\n//!   [`None`] values unchanged\n//!\n//! [`Some(t)`]: Some\n//! [`filter`]: Option::filter\n//! [`flatten`]: Option::flatten\n//! [`map`]: Option::map\n//!\n//! These methods transform [`Option<T>`] to a value of a possibly\n//! different type `U`:\n//!\n//! * [`map_or`] applies the provided function to the contained value of\n//!   [`Some`], or returns the provided default value if the [`Option`] is\n//!   [`None`]\n//! * [`map_or_else`] applies the provided function to the contained value\n//!   of [`Some`], or returns the result of evaluating the provided\n//!   fallback function if the [`Option`] is [`None`]\n//!\n//! [`map_or`]: Option::map_or\n//! [`map_or_else`]: Option::map_or_else\n//!\n//! These methods combine the [`Some`] variants of two [`Option`] values:\n//!\n//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the\n//!   provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//! * [`zip_with`] calls the provided function `f` and returns\n//!   [`Some(f(s, o))`] if `self` is [`Some(s)`] and the provided\n//!   [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]\n//!\n//! [`Some(f(s, o))`]: Some\n//! [`Some(o)`]: Some\n//! [`Some(s)`]: Some\n//! [`Some((s, o))`]: Some\n//! [`zip`]: Option::zip\n//! [`zip_with`]: Option::zip_with\n//!\n//! ## Boolean operators\n//!\n//! These methods treat the [`Option`] as a boolean value, where [`Some`]\n//! acts like [`true`] and [`None`] acts like [`false`]. There are two\n//! categories of these methods: ones that take an [`Option`] as input, and\n//! ones that take a function as input (to be lazily evaluated).\n//!\n//! The [`and`], [`or`], and [`xor`] methods take another [`Option`] as\n//! input, and produce an [`Option`] as output. Only the [`and`] method can\n//! produce an [`Option<U>`] value having a different inner type `U` than\n//! [`Option<T>`].\n//!\n//! | method  | self      | input     | output    |\n//! |---------|-----------|-----------|-----------|\n//! | [`and`] | `None`    | (ignored) | `None`    |\n//! | [`and`] | `Some(x)` | `None`    | `None`    |\n//! | [`and`] | `Some(x)` | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `None`    | `None`    | `None`    |\n//! | [`or`]  | `None`    | `Some(y)` | `Some(y)` |\n//! | [`or`]  | `Some(x)` | (ignored) | `Some(x)` |\n//! | [`xor`] | `None`    | `None`    | `None`    |\n//! | [`xor`] | `None`    | `Some(y)` | `Some(y)` |\n//! | [`xor`] | `Some(x)` | `None`    | `Some(x)` |\n//! | [`xor`] | `Some(x)` | `Some(y)` | `None`    |\n//!\n//! [`and`]: Option::and\n//! [`or`]: Option::or\n//! [`xor`]: Option::xor\n//!\n//! The [`and_then`] and [`or_else`] methods take a function as input, and\n//! only evaluate the function when they need to produce a new value. Only\n//! the [`and_then`] method can produce an [`Option<U>`] value having a\n//! different inner type `U` than [`Option<T>`].\n//!\n//! | method       | self      | function input | function result | output    |\n//! |--------------|-----------|----------------|-----------------|-----------|\n//! | [`and_then`] | `None`    | (not provided) | (not evaluated) | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `None`          | `None`    |\n//! | [`and_then`] | `Some(x)` | `x`            | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `None`    | (not provided) | `None`          | `None`    |\n//! | [`or_else`]  | `None`    | (not provided) | `Some(y)`       | `Some(y)` |\n//! | [`or_else`]  | `Some(x)` | (not provided) | (not evaluated) | `Some(x)` |\n//!\n//! [`and_then`]: Option::and_then\n//! [`or_else`]: Option::or_else\n//!\n//! This is an example of using methods like [`and_then`] and [`or`] in a\n//! pipeline of method calls. Early stages of the pipeline pass failure\n//! values ([`None`]) through unchanged, and continue processing on\n//! success values ([`Some`]). Toward the end, [`or`] substitutes an error\n//! message if it receives [`None`].\n//!\n//! ```\n//! # use std::collections::BTreeMap;\n//! let mut bt = BTreeMap::new();\n//! bt.insert(20u8, \"foo\");\n//! bt.insert(42u8, \"bar\");\n//! let res = [0u8, 1, 11, 200, 22]\n//!     .into_iter()\n//!     .map(|x| {\n//!         // `checked_sub()` returns `None` on error\n//!         x.checked_sub(1)\n//!             // same with `checked_mul()`\n//!             .and_then(|x| x.checked_mul(2))\n//!             // `BTreeMap::get` returns `None` on error\n//!             .and_then(|x| bt.get(&x))\n//!             // Substitute an error message if we have `None` so far\n//!             .or(Some(&\"error!\"))\n//!             .copied()\n//!             // Won't panic because we unconditionally used `Some` above\n//!             .unwrap()\n//!     })\n//!     .collect::<Vec<_>>();\n//! assert_eq!(res, [\"error!\", \"error!\", \"foo\", \"error!\", \"bar\"]);\n//! ```\n//!\n//! ## Comparison operators\n//!\n//! If `T` implements [`PartialOrd`] then [`Option<T>`] will derive its\n//! [`PartialOrd`] implementation.  With this order, [`None`] compares as\n//! less than any [`Some`], and two [`Some`] compare the same way as their\n//! contained values would in `T`.  If `T` also implements\n//! [`Ord`], then so does [`Option<T>`].\n//!\n//! ```\n//! assert!(None < Some(0));\n//! assert!(Some(0) < Some(1));\n//! ```\n//!\n//! ## Iterating over `Option`\n//!\n//! An [`Option`] can be iterated over. This can be helpful if you need an\n//! iterator that is conditionally empty. The iterator will either produce\n//! a single value (when the [`Option`] is [`Some`]), or produce no values\n//! (when the [`Option`] is [`None`]). For example, [`into_iter`] acts like\n//! [`once(v)`] if the [`Option`] is [`Some(v)`], and like [`empty()`] if\n//! the [`Option`] is [`None`].\n//!\n//! [`Some(v)`]: Some\n//! [`empty()`]: crate::iter::empty\n//! [`once(v)`]: crate::iter::once\n//!\n//! Iterators over [`Option<T>`] come in three types:\n//!\n//! * [`into_iter`] consumes the [`Option`] and produces the contained\n//!   value\n//! * [`iter`] produces an immutable reference of type `&T` to the\n//!   contained value\n//! * [`iter_mut`] produces a mutable reference of type `&mut T` to the\n//!   contained value\n//!\n//! [`into_iter`]: Option::into_iter\n//! [`iter`]: Option::iter\n//! [`iter_mut`]: Option::iter_mut\n//!\n//! An iterator over [`Option`] can be useful when chaining iterators, for\n//! example, to conditionally insert items. (It's not always necessary to\n//! explicitly call an iterator constructor: many [`Iterator`] methods that\n//! accept other iterators will also accept iterable types that implement\n//! [`IntoIterator`], which includes [`Option`].)\n//!\n//! ```\n//! let yep = Some(42);\n//! let nope = None;\n//! // chain() already calls into_iter(), so we don't have to do so\n//! let nums: Vec<i32> = (0..4).chain(yep).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 42, 4, 5, 6, 7]);\n//! let nums: Vec<i32> = (0..4).chain(nope).chain(4..8).collect();\n//! assert_eq!(nums, [0, 1, 2, 3, 4, 5, 6, 7]);\n//! ```\n//!\n//! One reason to chain iterators in this way is that a function returning\n//! `impl Iterator` must have all possible return values be of the same\n//! concrete type. Chaining an iterated [`Option`] can help with that.\n//!\n//! ```\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types matching\n//!     match do_insert {\n//!         true => return (0..4).chain(Some(42)).chain(4..8),\n//!         false => return (0..4).chain(None).chain(4..8),\n//!     }\n//! }\n//! println!(\"{:?}\", make_iter(true).collect::<Vec<_>>());\n//! println!(\"{:?}\", make_iter(false).collect::<Vec<_>>());\n//! ```\n//!\n//! If we try to do the same thing, but using [`once()`] and [`empty()`],\n//! we can't return `impl Iterator` anymore because the concrete types of\n//! the return values differ.\n//!\n//! [`empty()`]: crate::iter::empty\n//! [`once()`]: crate::iter::once\n//!\n//! ```compile_fail,E0308\n//! # use std::iter::{empty, once};\n//! // This won't compile because all possible returns from the function\n//! // must have the same concrete type.\n//! fn make_iter(do_insert: bool) -> impl Iterator<Item = i32> {\n//!     // Explicit returns to illustrate return types not matching\n//!     match do_insert {\n//!         true => return (0..4).chain(once(42)).chain(4..8),\n//!         false => return (0..4).chain(empty()).chain(4..8),\n//!     }\n//! }\n//! ```\n//!\n//! ## Collecting into `Option`\n//!\n//! [`Option`] implements the [`FromIterator`][impl-FromIterator] trait,\n//! which allows an iterator over [`Option`] values to be collected into an\n//! [`Option`] of a collection of each contained value of the original\n//! [`Option`] values, or [`None`] if any of the elements was [`None`].\n//!\n//! [impl-FromIterator]: Option#impl-FromIterator%3COption%3CA%3E%3E\n//!\n//! ```\n//! let v = [Some(2), Some(4), None, Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, None);\n//! let v = [Some(2), Some(4), Some(8)];\n//! let res: Option<Vec<_>> = v.into_iter().collect();\n//! assert_eq!(res, Some(vec![2, 4, 8]));\n//! ```\n//!\n//! [`Option`] also implements the [`Product`][impl-Product] and\n//! [`Sum`][impl-Sum] traits, allowing an iterator over [`Option`] values\n//! to provide the [`product`][Iterator::product] and\n//! [`sum`][Iterator::sum] methods.\n//!\n//! [impl-Product]: Option#impl-Product%3COption%3CU%3E%3E\n//! [impl-Sum]: Option#impl-Sum%3COption%3CU%3E%3E\n//!\n//! ```\n//! let v = [None, Some(1), Some(2), Some(3)];\n//! let res: Option<i32> = v.into_iter().sum();\n//! assert_eq!(res, None);\n//! let v = [Some(1), Some(2), Some(21)];\n//! let res: Option<i32> = v.into_iter().product();\n//! assert_eq!(res, Some(42));\n//! ```\n//!\n//! ## Modifying an [`Option`] in-place\n//!\n//! These methods return a mutable reference to the contained value of an\n//! [`Option<T>`]:\n//!\n//! * [`insert`] inserts a value, dropping any old contents\n//! * [`get_or_insert`] gets the current value, inserting a provided\n//!   default value if it is [`None`]\n//! * [`get_or_insert_default`] gets the current value, inserting the\n//!   default value of type `T` (which must implement [`Default`]) if it is\n//!   [`None`]\n//! * [`get_or_insert_with`] gets the current value, inserting a default\n//!   computed by the provided function if it is [`None`]\n//!\n//! [`get_or_insert`]: Option::get_or_insert\n//! [`get_or_insert_default`]: Option::get_or_insert_default\n//! [`get_or_insert_with`]: Option::get_or_insert_with\n//! [`insert`]: Option::insert\n//!\n//! These methods transfer ownership of the contained value of an\n//! [`Option`]:\n//!\n//! * [`take`] takes ownership of the contained value of an [`Option`], if\n//!   any, replacing the [`Option`] with [`None`]\n//! * [`replace`] takes ownership of the contained value of an [`Option`],\n//!   if any, replacing the [`Option`] with a [`Some`] containing the\n//!   provided value\n//!\n//! [`replace`]: Option::replace\n//! [`take`]: Option::take\n//!\n//! # Examples\n//!\n//! Basic pattern matching on [`Option`]:\n//!\n//! ```\n//! let msg = Some(\"howdy\");\n//!\n//! // Take a reference to the contained string\n//! if let Some(m) = &msg {\n//!     println!(\"{}\", *m);\n//! }\n//!\n//! // Remove the contained string, destroying the Option\n//! let unwrapped_msg = msg.unwrap_or(\"default message\");\n//! ```\n//!\n//! Initialize a result to [`None`] before a loop:\n//!\n//! ```\n//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }\n//!\n//! // A list of data to search through.\n//! let all_the_big_things = [\n//!     Kingdom::Plant(250, \"redwood\"),\n//!     Kingdom::Plant(230, \"noble fir\"),\n//!     Kingdom::Plant(229, \"sugar pine\"),\n//!     Kingdom::Animal(25, \"blue whale\"),\n//!     Kingdom::Animal(19, \"fin whale\"),\n//!     Kingdom::Animal(15, \"north pacific right whale\"),\n//! ];\n//!\n//! // We're going to search for the name of the biggest animal,\n//! // but to start with we've just got `None`.\n//! let mut name_of_biggest_animal = None;\n//! let mut size_of_biggest_animal = 0;\n//! for big_thing in &all_the_big_things {\n//!     match *big_thing {\n//!         Kingdom::Animal(size, name) if size > size_of_biggest_animal => {\n//!             // Now we've found the name of some big animal\n//!             size_of_biggest_animal = size;\n//!             name_of_biggest_animal = Some(name);\n//!         }\n//!         Kingdom::Animal(..) | Kingdom::Plant(..) => ()\n//!     }\n//! }\n//!\n//! match name_of_biggest_animal {\n//!     Some(name) => println!(\"the biggest animal is {name}\"),\n//!     None => println!(\"there are no animals :(\"),\n//! }\n//! ```\n\n#![stable(feature = \"rust1\", since = \"1.0.0\")]\n\nuse crate::iter::{self, FromIterator, FusedIterator, TrustedLen};\nuse crate::marker::Destruct;\nuse crate::panicking::{panic, panic_str};\nuse crate::pin::Pin;\nuse crate::{\n    convert, hint, mem,\n    ops::{self, ControlFlow, Deref, DerefMut},\n};\n\n/// The `Option` type. See [the module level documentation](self) for more.\n#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]\n#[rustc_diagnostic_item = \"Option\"]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub enum Option<T> {\n    /// No value.\n    #[lang = \"None\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    None,\n    /// Some value of type `T`.\n    #[lang = \"Some\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    Some(#[stable(feature = \"rust1\", since = \"1.0.0\")] T),\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Type implementation\n/////////////////////////////////////////////////////////////////////////////\n\nimpl<T> Option<T> {\n    /////////////////////////////////////////////////////////////////////////\n    // Querying the contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns `true` if the option is a [`Some`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some(), true);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some(), false);\n    /// ```\n    #[must_use = \"if you intended to assert that this has a value, consider `.unwrap()` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_some(&self) -> bool {\n        matches!(*self, Some(_))\n    }\n\n    /// Returns `true` if the option is a [`Some`] and the value inside of it matches a predicate.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(is_some_with)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), true);\n    ///\n    /// let x: Option<u32> = Some(0);\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_some_and(|&x| x > 1), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"is_some_with\", issue = \"93050\")]\n    pub fn is_some_and(&self, f: impl FnOnce(&T) -> bool) -> bool {\n        matches!(self, Some(x) if f(x))\n    }\n\n    /// Returns `true` if the option is a [`None`] value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.is_none(), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.is_none(), true);\n    /// ```\n    #[must_use = \"if you intended to assert that this doesn't have a value, consider \\\n                  `.and_then(|_| panic!(\\\"`Option` had a value when expected `None`\\\"))` instead\"]\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    pub const fn is_none(&self) -> bool {\n        !self.is_some()\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Adapter for working with references\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `as_ref` to first take an `Option` to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let text: Option<String> = Some(\"Hello, world!\".to_string());\n    /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,\n    /// // then consume *that* with `map`, leaving `text` on the stack.\n    /// let text_length: Option<usize> = text.as_ref().map(|s| s.len());\n    /// println!(\"still can print text: {text:?}\");\n    /// ```\n    #[inline]\n    #[rustc_const_stable(feature = \"const_option_basics\", since = \"1.48.0\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn as_ref(&self) -> Option<&T> {\n        match *self {\n            Some(ref x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// match x.as_mut() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn as_mut(&mut self) -> Option<&mut T> {\n        match *self {\n            Some(ref mut x) => Some(x),\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&]Option\\<T>></code> to <code>Option<[Pin]<[&]T>></code>.\n    ///\n    /// [&]: reference \"shared reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {\n        match Pin::get_ref(self).as_ref() {\n            // SAFETY: `x` is guaranteed to be pinned because it comes from `self`\n            // which is pinned.\n            Some(x) => unsafe { Some(Pin::new_unchecked(x)) },\n            None => None,\n        }\n    }\n\n    /// Converts from <code>[Pin]<[&mut] Option\\<T>></code> to <code>Option<[Pin]<[&mut] T>></code>.\n    ///\n    /// [&mut]: reference \"mutable reference\"\n    #[inline]\n    #[must_use]\n    #[stable(feature = \"pin\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {\n        // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.\n        // `x` is guaranteed to be pinned because it comes from `self` which is pinned.\n        unsafe {\n            match Pin::get_unchecked_mut(self).as_mut() {\n                Some(x) => Some(Pin::new_unchecked(x)),\n                None => None,\n            }\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Getting to contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the value is a [`None`] with a custom panic message provided by\n    /// `msg`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"value\");\n    /// assert_eq!(x.expect(\"fruits are healthy\"), \"value\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// x.expect(\"fruits are healthy\"); // panics with `fruits are healthy`\n    /// ```\n    ///\n    /// # Recommended Message Style\n    ///\n    /// We recommend that `expect` messages are used to describe the reason you\n    /// _expect_ the `Option` should be `Some`.\n    ///\n    /// ```should_panic\n    /// # let slice: &[u8] = &[];\n    /// let item = slice.get(0)\n    ///     .expect(\"slice should not be empty\");\n    /// ```\n    ///\n    /// **Hint**: If you're having trouble remembering how to phrase expect\n    /// error messages remember to focus on the word \"should\" as in \"env\n    /// variable should be set by blah\" or \"the given binary should be available\n    /// and executable by the current user\".\n    ///\n    /// For more detail on expect message styles and the reasoning behind our\n    /// recommendation please refer to the section on [\"Common Message\n    /// Styles\"](../../std/error/index.html#common-message-styles) in the [`std::error`](../../std/error/index.html) module docs.\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn expect(self, msg: &str) -> T {\n        match self {\n            Some(val) => val,\n            None => expect_failed(msg),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value.\n    ///\n    /// Because this function may panic, its use is generally discouraged.\n    /// Instead, prefer to use pattern matching and handle the [`None`]\n    /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or\n    /// [`unwrap_or_default`].\n    ///\n    /// [`unwrap_or`]: Option::unwrap_or\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    /// [`unwrap_or_default`]: Option::unwrap_or_default\n    ///\n    /// # Panics\n    ///\n    /// Panics if the self value equals [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(x.unwrap(), \"air\");\n    /// ```\n    ///\n    /// ```should_panic\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.unwrap(), \"air\"); // fails\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn unwrap(self) -> T {\n        match self {\n            Some(val) => val,\n            None => panic(\"called `Option::unwrap()` on a `None` value\"),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a provided default.\n    ///\n    /// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`unwrap_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`unwrap_or_else`]: Option::unwrap_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// assert_eq!(Some(\"car\").unwrap_or(\"bike\"), \"car\");\n    /// assert_eq!(None.unwrap_or(\"bike\"), \"bike\");\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or(self, default: T) -> T\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => default,\n        }\n    }\n\n    /// Returns the contained [`Some`] value or computes it from a closure.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 10;\n    /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);\n    /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_else<F>(self, f: F) -> T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => x,\n            None => f(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value or a default.\n    ///\n    /// Consumes the `self` argument then, if [`Some`], returns the contained\n    /// value, otherwise if [`None`], returns the [default value] for that\n    /// type.\n    ///\n    /// # Examples\n    ///\n    /// Converts a string to an integer, turning poorly-formed strings\n    /// into 0 (the default value for integers). [`parse`] converts\n    /// a string to any other type that implements [`FromStr`], returning\n    /// [`None`] on error.\n    ///\n    /// ```\n    /// let good_year_from_input = \"1909\";\n    /// let bad_year_from_input = \"190blarg\";\n    /// let good_year = good_year_from_input.parse().ok().unwrap_or_default();\n    /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();\n    ///\n    /// assert_eq!(1909, good_year);\n    /// assert_eq!(0, bad_year);\n    /// ```\n    ///\n    /// [default value]: Default::default\n    /// [`parse`]: str::parse\n    /// [`FromStr`]: crate::str::FromStr\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn unwrap_or_default(self) -> T\n    where\n        T: ~const Default,\n    {\n        match self {\n            Some(x) => x,\n            None => Default::default(),\n        }\n    }\n\n    /// Returns the contained [`Some`] value, consuming the `self` value,\n    /// without checking that the value is not [`None`].\n    ///\n    /// # Safety\n    ///\n    /// Calling this method on [`None`] is *[undefined behavior]*.\n    ///\n    /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"air\");\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\");\n    /// ```\n    ///\n    /// ```no_run\n    /// let x: Option<&str> = None;\n    /// assert_eq!(unsafe { x.unwrap_unchecked() }, \"air\"); // Undefined behavior!\n    /// ```\n    #[inline]\n    #[track_caller]\n    #[stable(feature = \"option_result_unwrap_unchecked\", since = \"1.58.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const unsafe fn unwrap_unchecked(self) -> T {\n        debug_assert!(self.is_some());\n        match self {\n            Some(val) => val,\n            // SAFETY: the safety contract must be upheld by the caller.\n            None => unsafe { hint::unreachable_unchecked() },\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Transforming contained values\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming\n    /// the original:\n    ///\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    /// ```\n    /// let maybe_some_string = Some(String::from(\"Hello, World!\"));\n    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`\n    /// let maybe_some_len = maybe_some_string.map(|s| s.len());\n    ///\n    /// assert_eq!(maybe_some_len, Some(13));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(f(x)),\n            None => None,\n        }\n    }\n\n    /// Calls the provided closure with a reference to the contained value (if [`Some`]).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(result_option_inspect)]\n    ///\n    /// let v = vec![1, 2, 3, 4, 5];\n    ///\n    /// // prints \"got: 4\"\n    /// let x: Option<&usize> = v.get(3).inspect(|x| println!(\"got: {x}\"));\n    ///\n    /// // prints nothing\n    /// let x: Option<&usize> = v.get(5).inspect(|x| println!(\"got: {x}\"));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"result_option_inspect\", issue = \"91345\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn inspect<F>(self, f: F) -> Self\n    where\n        F: ~const FnOnce(&T),\n        F: ~const Destruct,\n    {\n        if let Some(ref x) = self {\n            f(x);\n        }\n\n        self\n    }\n\n    /// Returns the provided default result (if none),\n    /// or applies a function to the contained value (if any).\n    ///\n    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing\n    /// the result of a function call, it is recommended to use [`map_or_else`],\n    /// which is lazily evaluated.\n    ///\n    /// [`map_or_else`]: Option::map_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or(42, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or(42, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or<U, F>(self, default: U, f: F) -> U\n    where\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default,\n        }\n    }\n\n    /// Computes a default function result (if none), or\n    /// applies a different function to the contained value (if any).\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let k = 21;\n    ///\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 3);\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U\n    where\n        D: ~const FnOnce() -> U,\n        D: ~const Destruct,\n        F: ~const FnOnce(T) -> U,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(t) => f(t),\n            None => default(),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err)`].\n    ///\n    /// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`ok_or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err)`]: Err\n    /// [`Some(v)`]: Some\n    /// [`ok_or_else`]: Option::ok_or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or(0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or(0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or<E>(self, err: E) -> Result<T, E>\n    where\n        E: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err),\n        }\n    }\n\n    /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to\n    /// [`Ok(v)`] and [`None`] to [`Err(err())`].\n    ///\n    /// [`Ok(v)`]: Ok\n    /// [`Err(err())`]: Err\n    /// [`Some(v)`]: Some\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"foo\");\n    /// assert_eq!(x.ok_or_else(|| 0), Ok(\"foo\"));\n    ///\n    /// let x: Option<&str> = None;\n    /// assert_eq!(x.ok_or_else(|| 0), Err(0));\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>\n    where\n        F: ~const FnOnce() -> E,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(v) => Ok(v),\n            None => Err(err()),\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.\n    ///\n    /// Leaves the original Option in-place, creating a new one with a reference\n    /// to the original one, additionally coercing the contents via [`Deref`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref(), Some(\"hey\"));\n    ///\n    /// let x: Option<String> = None;\n    /// assert_eq!(x.as_deref(), None);\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref(&self) -> Option<&T::Target>\n    where\n        T: ~const Deref,\n    {\n        match self.as_ref() {\n            Some(t) => Some(t.deref()),\n            None => None,\n        }\n    }\n\n    /// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.\n    ///\n    /// Leaves the original `Option` in-place, creating a new one containing a mutable reference to\n    /// the inner type's [`Deref::Target`] type.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x: Option<String> = Some(\"hey\".to_owned());\n    /// assert_eq!(x.as_deref_mut().map(|x| {\n    ///     x.make_ascii_uppercase();\n    ///     x\n    /// }), Some(\"HEY\".to_owned().as_mut_str()));\n    /// ```\n    #[stable(feature = \"option_deref\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>\n    where\n        T: ~const DerefMut,\n    {\n        match self.as_mut() {\n            Some(t) => Some(t.deref_mut()),\n            None => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Iterator constructors\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns an iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(4);\n    /// assert_eq!(x.iter().next(), Some(&4));\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.iter().next(), None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub const fn iter(&self) -> Iter<'_, T> {\n        Iter { inner: Item { opt: self.as_ref() } }\n    }\n\n    /// Returns a mutable iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(4);\n    /// match x.iter_mut().next() {\n    ///     Some(v) => *v = 42,\n    ///     None => {},\n    /// }\n    /// assert_eq!(x, Some(42));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// assert_eq!(x.iter_mut().next(), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    pub fn iter_mut(&mut self) -> IterMut<'_, T> {\n        IterMut { inner: Item { opt: self.as_mut() } }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Boolean operations on the values, eager and lazy\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Returns [`None`] if the option is [`None`], otherwise returns `optb`.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), None);\n    ///\n    /// let x = Some(2);\n    /// let y = Some(\"foo\");\n    /// assert_eq!(x.and(y), Some(\"foo\"));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<&str> = None;\n    /// assert_eq!(x.and(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and<U>(self, optb: Option<U>) -> Option<U>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match self {\n            Some(_) => optb,\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `f` with the\n    /// wrapped value and returns the result.\n    ///\n    /// Some languages call this operation flatmap.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn sq_then_to_string(x: u32) -> Option<String> {\n    ///     x.checked_mul(x).map(|sq| sq.to_string())\n    /// }\n    ///\n    /// assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string()));\n    /// assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed!\n    /// assert_eq!(None.and_then(sq_then_to_string), None);\n    /// ```\n    ///\n    /// Often used to chain fallible operations that may return [`None`].\n    ///\n    /// ```\n    /// let arr_2d = [[\"A0\", \"A1\"], [\"B0\", \"B1\"]];\n    ///\n    /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1));\n    /// assert_eq!(item_0_1, Some(&\"A1\"));\n    ///\n    /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));\n    /// assert_eq!(item_2_0, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn and_then<U, F>(self, f: F) -> Option<U>\n    where\n        F: ~const FnOnce(T) -> Option<U>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => f(x),\n            None => None,\n        }\n    }\n\n    /// Returns [`None`] if the option is [`None`], otherwise calls `predicate`\n    /// with the wrapped value and returns:\n    ///\n    /// - [`Some(t)`] if `predicate` returns `true` (where `t` is the wrapped\n    ///   value), and\n    /// - [`None`] if `predicate` returns `false`.\n    ///\n    /// This function works similar to [`Iterator::filter()`]. You can imagine\n    /// the `Option<T>` being an iterator over one or zero elements. `filter()`\n    /// lets you decide which elements to keep.\n    ///\n    /// # Examples\n    ///\n    /// ```rust\n    /// fn is_even(n: &i32) -> bool {\n    ///     n % 2 == 0\n    /// }\n    ///\n    /// assert_eq!(None.filter(is_even), None);\n    /// assert_eq!(Some(3).filter(is_even), None);\n    /// assert_eq!(Some(4).filter(is_even), Some(4));\n    /// ```\n    ///\n    /// [`Some(t)`]: Some\n    #[inline]\n    #[stable(feature = \"option_filter\", since = \"1.27.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn filter<P>(self, predicate: P) -> Self\n    where\n        T: ~const Destruct,\n        P: ~const FnOnce(&T) -> bool,\n        P: ~const Destruct,\n    {\n        if let Some(x) = self {\n            if predicate(&x) {\n                return Some(x);\n            }\n        }\n        None\n    }\n\n    /// Returns the option if it contains a value, otherwise returns `optb`.\n    ///\n    /// Arguments passed to `or` are eagerly evaluated; if you are passing the\n    /// result of a function call, it is recommended to use [`or_else`], which is\n    /// lazily evaluated.\n    ///\n    /// [`or_else`]: Option::or_else\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y = None;\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x = None;\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(100));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(100);\n    /// assert_eq!(x.or(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = None;\n    /// assert_eq!(x.or(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => optb,\n        }\n    }\n\n    /// Returns the option if it contains a value, otherwise calls `f` and\n    /// returns the result.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// fn nobody() -> Option<&'static str> { None }\n    /// fn vikings() -> Option<&'static str> { Some(\"vikings\") }\n    ///\n    /// assert_eq!(Some(\"barbarians\").or_else(vikings), Some(\"barbarians\"));\n    /// assert_eq!(None.or_else(vikings), Some(\"vikings\"));\n    /// assert_eq!(None.or_else(nobody), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn or_else<F>(self, f: F) -> Option<T>\n    where\n        F: ~const FnOnce() -> Option<T>,\n        F: ~const Destruct,\n    {\n        match self {\n            Some(x) => Some(x),\n            None => f(),\n        }\n    }\n\n    /// Returns [`Some`] if exactly one of `self`, `optb` is [`Some`], otherwise returns [`None`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(2);\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x: Option<u32> = None;\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), Some(2));\n    ///\n    /// let x = Some(2);\n    /// let y = Some(2);\n    /// assert_eq!(x.xor(y), None);\n    ///\n    /// let x: Option<u32> = None;\n    /// let y: Option<u32> = None;\n    /// assert_eq!(x.xor(y), None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_xor\", since = \"1.37.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn xor(self, optb: Option<T>) -> Option<T>\n    where\n        T: ~const Destruct,\n    {\n        match (self, optb) {\n            (Some(a), None) => Some(a),\n            (None, Some(b)) => Some(b),\n            _ => None,\n        }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Entry-like operations to insert a value and return a reference\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Inserts `value` into the option, then returns a mutable reference to it.\n    ///\n    /// If the option already contains a value, the old value is dropped.\n    ///\n    /// See also [`Option::get_or_insert`], which doesn't update the value if\n    /// the option already contains [`Some`].\n    ///\n    /// # Example\n    ///\n    /// ```\n    /// let mut opt = None;\n    /// let val = opt.insert(1);\n    /// assert_eq!(*val, 1);\n    /// assert_eq!(opt.unwrap(), 1);\n    /// let val = opt.insert(2);\n    /// assert_eq!(*val, 2);\n    /// *val = 3;\n    /// assert_eq!(opt.unwrap(), 3);\n    /// ```\n    #[must_use = \"if you intended to set a value, consider assignment instead\"]\n    #[inline]\n    #[stable(feature = \"option_insert\", since = \"1.53.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        *self = Some(value);\n\n        // SAFETY: the code above just filled the option\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts `value` into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// See also [`Option::insert`], which updates the value even if\n    /// the option already contains [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert(5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert(&mut self, value: T) -> &mut T\n    where\n        T: ~const Destruct,\n    {\n        if let None = *self {\n            *self = Some(value);\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /// Inserts the default value into the option if it is [`None`], then\n    /// returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_get_or_insert_default)]\n    ///\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_default();\n    ///     assert_eq!(y, &0);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"option_get_or_insert_default\", issue = \"82901\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_default(&mut self) -> &mut T\n    where\n        T: ~const Default,\n    {\n        const fn default<T: ~const Default>() -> T {\n            T::default()\n        }\n\n        self.get_or_insert_with(default)\n    }\n\n    /// Inserts a value computed from `f` into the option if it is [`None`],\n    /// then returns a mutable reference to the contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = None;\n    ///\n    /// {\n    ///     let y: &mut u32 = x.get_or_insert_with(|| 5);\n    ///     assert_eq!(y, &5);\n    ///\n    ///     *y = 7;\n    /// }\n    ///\n    /// assert_eq!(x, Some(7));\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_entry\", since = \"1.20.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T\n    where\n        F: ~const FnOnce() -> T,\n        F: ~const Destruct,\n    {\n        if let None = *self {\n            // the compiler isn't smart enough to know that we are not dropping a `T`\n            // here and wants us to ensure `T` can be dropped at compile time.\n            mem::forget(mem::replace(self, Some(f())))\n        }\n\n        // SAFETY: a `None` variant for `self` would have been replaced by a `Some`\n        // variant in the code above.\n        unsafe { self.as_mut().unwrap_unchecked() }\n    }\n\n    /////////////////////////////////////////////////////////////////////////\n    // Misc\n    /////////////////////////////////////////////////////////////////////////\n\n    /// Takes the value out of the option, leaving a [`None`] in its place.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, Some(2));\n    ///\n    /// let mut x: Option<u32> = None;\n    /// let y = x.take();\n    /// assert_eq!(x, None);\n    /// assert_eq!(y, None);\n    /// ```\n    #[inline]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn take(&mut self) -> Option<T> {\n        // FIXME replace `mem::replace` by `mem::take` when the latter is const ready\n        mem::replace(self, None)\n    }\n\n    /// Replaces the actual value in the option by the value given in parameter,\n    /// returning the old value if present,\n    /// leaving a [`Some`] in its place without deinitializing either one.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = Some(2);\n    /// let old = x.replace(5);\n    /// assert_eq!(x, Some(5));\n    /// assert_eq!(old, Some(2));\n    ///\n    /// let mut x = None;\n    /// let old = x.replace(3);\n    /// assert_eq!(x, Some(3));\n    /// assert_eq!(old, None);\n    /// ```\n    #[inline]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    #[stable(feature = \"option_replace\", since = \"1.31.0\")]\n    pub const fn replace(&mut self, value: T) -> Option<T> {\n        mem::replace(self, Some(value))\n    }\n\n    /// Returns `true` if the option is a [`Some`] value containing the given value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_result_contains)]\n    ///\n    /// let x: Option<u32> = Some(2);\n    /// assert_eq!(x.contains(&2), true);\n    ///\n    /// let x: Option<u32> = Some(3);\n    /// assert_eq!(x.contains(&2), false);\n    ///\n    /// let x: Option<u32> = None;\n    /// assert_eq!(x.contains(&2), false);\n    /// ```\n    #[must_use]\n    #[inline]\n    #[unstable(feature = \"option_result_contains\", issue = \"62358\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn contains<U>(&self, x: &U) -> bool\n    where\n        U: ~const PartialEq<T>,\n    {\n        match self {\n            Some(y) => x.eq(y),\n            None => false,\n        }\n    }\n\n    /// Zips `self` with another `Option`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(1);\n    /// let y = Some(\"hi\");\n    /// let z = None::<u8>;\n    ///\n    /// assert_eq!(x.zip(y), Some((1, \"hi\")));\n    /// assert_eq!(x.zip(z), None);\n    /// ```\n    #[stable(feature = \"option_zip_option\", since = \"1.46.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>\n    where\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some((a, b)),\n            _ => None,\n        }\n    }\n\n    /// Zips `self` and another `Option` with function `f`.\n    ///\n    /// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`.\n    /// Otherwise, `None` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(option_zip)]\n    ///\n    /// #[derive(Debug, PartialEq)]\n    /// struct Point {\n    ///     x: f64,\n    ///     y: f64,\n    /// }\n    ///\n    /// impl Point {\n    ///     fn new(x: f64, y: f64) -> Self {\n    ///         Self { x, y }\n    ///     }\n    /// }\n    ///\n    /// let x = Some(17.5);\n    /// let y = Some(42.7);\n    ///\n    /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 }));\n    /// assert_eq!(x.zip_with(None, Point::new), None);\n    /// ```\n    #[unstable(feature = \"option_zip\", issue = \"70086\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>\n    where\n        F: ~const FnOnce(T, U) -> R,\n        F: ~const Destruct,\n        T: ~const Destruct,\n        U: ~const Destruct,\n    {\n        match (self, other) {\n            (Some(a), Some(b)) => Some(f(a, b)),\n            _ => None,\n        }\n    }\n}\n\nimpl<T, U> Option<(T, U)> {\n    /// Unzips an option containing a tuple of two options.\n    ///\n    /// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.\n    /// Otherwise, `(None, None)` is returned.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #![feature(unzip_option)]\n    ///\n    /// let x = Some((1, \"hi\"));\n    /// let y = None::<(u8, u32)>;\n    ///\n    /// assert_eq!(x.unzip(), (Some(1), Some(\"hi\")));\n    /// assert_eq!(y.unzip(), (None, None));\n    /// ```\n    #[inline]\n    #[unstable(feature = \"unzip_option\", issue = \"87800\", reason = \"recently added\")]\n    pub const fn unzip(self) -> (Option<T>, Option<U>) {\n        match self {\n            Some((a, b)) => (Some(a), Some(b)),\n            None => (None, None),\n        }\n    }\n}\n\nimpl<T> Option<&T> {\n    /// Maps an `Option<&T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        // FIXME: this implementation, which sidesteps using `Option::map` since it's not const\n        // ready yet, should be reverted when possible to avoid code repetition\n        match self {\n            Some(&v) => Some(v),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = 12;\n    /// let opt_x = Some(&x);\n    /// assert_eq!(opt_x, Some(&12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"rust1\", since = \"1.0.0\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T> Option<&mut T> {\n    /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let copied = opt_x.copied();\n    /// assert_eq!(copied, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(feature = \"copied\", since = \"1.35.0\")]\n    #[rustc_const_unstable(feature = \"const_option_ext\", issue = \"91930\")]\n    pub const fn copied(self) -> Option<T>\n    where\n        T: Copy,\n    {\n        match self {\n            Some(&mut t) => Some(t),\n            None => None,\n        }\n    }\n\n    /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the\n    /// option.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut x = 12;\n    /// let opt_x = Some(&mut x);\n    /// assert_eq!(opt_x, Some(&mut 12));\n    /// let cloned = opt_x.cloned();\n    /// assert_eq!(cloned, Some(12));\n    /// ```\n    #[must_use = \"`self` will be dropped if the result is not used\"]\n    #[stable(since = \"1.26.0\", feature = \"option_ref_mut_cloned\")]\n    #[rustc_const_unstable(feature = \"const_option_cloned\", issue = \"91582\")]\n    pub const fn cloned(self) -> Option<T>\n    where\n        T: ~const Clone,\n    {\n        match self {\n            Some(t) => Some(t.clone()),\n            None => None,\n        }\n    }\n}\n\nimpl<T, E> Option<Result<T, E>> {\n    /// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.\n    ///\n    /// [`None`] will be mapped to <code>[Ok]\\([None])</code>.\n    /// <code>[Some]\\([Ok]\\(\\_))</code> and <code>[Some]\\([Err]\\(\\_))</code> will be mapped to\n    /// <code>[Ok]\\([Some]\\(\\_))</code> and <code>[Err]\\(\\_)</code>.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// #[derive(Debug, Eq, PartialEq)]\n    /// struct SomeErr;\n    ///\n    /// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));\n    /// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));\n    /// assert_eq!(x, y.transpose());\n    /// ```\n    #[inline]\n    #[stable(feature = \"transpose_result\", since = \"1.33.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn transpose(self) -> Result<Option<T>, E> {\n        match self {\n            Some(Ok(x)) => Ok(Some(x)),\n            Some(Err(e)) => Err(e),\n            None => Ok(None),\n        }\n    }\n}\n\n// This is a separate function to reduce the code size of .expect() itself.\n#[cfg_attr(not(feature = \"panic_immediate_abort\"), inline(never))]\n#[cfg_attr(feature = \"panic_immediate_abort\", inline)]\n#[cold]\n#[track_caller]\n#[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\nconst fn expect_failed(msg: &str) -> ! {\n    panic_str(msg)\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// Trait implementations\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_clone\", issue = \"91805\")]\nimpl<T> const Clone for Option<T>\nwhere\n    T: ~const Clone + ~const Destruct,\n{\n    #[inline]\n    fn clone(&self) -> Self {\n        match self {\n            Some(x) => Some(x.clone()),\n            None => None,\n        }\n    }\n\n    #[inline]\n    fn clone_from(&mut self, source: &Self) {\n        match (self, source) {\n            (Some(to), Some(from)) => to.clone_from(from),\n            (to, from) => *to = from.clone(),\n        }\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[rustc_const_unstable(feature = \"const_default_impls\", issue = \"87864\")]\nimpl<T> const Default for Option<T> {\n    /// Returns [`None`][Option::None].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let opt: Option<u32> = Option::default();\n    /// assert!(opt.is_none());\n    /// ```\n    #[inline]\n    fn default() -> Option<T> {\n        None\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<T> IntoIterator for Option<T> {\n    type Item = T;\n    type IntoIter = IntoIter<T>;\n\n    /// Returns a consuming iterator over the possibly contained value.\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let x = Some(\"string\");\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert_eq!(v, [\"string\"]);\n    ///\n    /// let x = None;\n    /// let v: Vec<&str> = x.into_iter().collect();\n    /// assert!(v.is_empty());\n    /// ```\n    #[inline]\n    fn into_iter(self) -> IntoIter<T> {\n        IntoIter { inner: Item { opt: self } }\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a Option<T> {\n    type Item = &'a T;\n    type IntoIter = Iter<'a, T>;\n\n    fn into_iter(self) -> Iter<'a, T> {\n        self.iter()\n    }\n}\n\n#[stable(since = \"1.4.0\", feature = \"option_iter\")]\nimpl<'a, T> IntoIterator for &'a mut Option<T> {\n    type Item = &'a mut T;\n    type IntoIter = IterMut<'a, T>;\n\n    fn into_iter(self) -> IterMut<'a, T> {\n        self.iter_mut()\n    }\n}\n\n#[stable(since = \"1.12.0\", feature = \"option_from\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const From<T> for Option<T> {\n    /// Moves `val` into a new [`Some`].\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let o: Option<u8> = Option::from(67);\n    ///\n    /// assert_eq!(Some(67), o);\n    /// ```\n    fn from(val: T) -> Option<T> {\n        Some(val)\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a Option<T>> for Option<&'a T> {\n    /// Converts from `&Option<T>` to `Option<&T>`.\n    ///\n    /// # Examples\n    ///\n    /// Converts an <code>[Option]<[String]></code> into an <code>[Option]<[usize]></code>, preserving\n    /// the original. The [`map`] method takes the `self` argument by value, consuming the original,\n    /// so this technique uses `from` to first take an [`Option`] to a reference\n    /// to the value inside the original.\n    ///\n    /// [`map`]: Option::map\n    /// [String]: ../../std/string/struct.String.html \"String\"\n    ///\n    /// ```\n    /// let s: Option<String> = Some(String::from(\"Hello, Rustaceans!\"));\n    /// let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());\n    ///\n    /// println!(\"Can still print s: {s:?}\");\n    ///\n    /// assert_eq!(o, Some(18));\n    /// ```\n    fn from(o: &'a Option<T>) -> Option<&'a T> {\n        o.as_ref()\n    }\n}\n\n#[stable(feature = \"option_ref_from_ref_option\", since = \"1.30.0\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {\n    /// Converts from `&mut Option<T>` to `Option<&mut T>`\n    ///\n    /// # Examples\n    ///\n    /// ```\n    /// let mut s = Some(String::from(\"Hello\"));\n    /// let o: Option<&mut String> = Option::from(&mut s);\n    ///\n    /// match o {\n    ///     Some(t) => *t = String::from(\"Hello, Rustaceans!\"),\n    ///     None => (),\n    /// }\n    ///\n    /// assert_eq!(s, Some(String::from(\"Hello, Rustaceans!\")));\n    /// ```\n    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {\n        o.as_mut()\n    }\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// The Option Iterators\n/////////////////////////////////////////////////////////////////////////////\n\n#[derive(Clone, Debug)]\nstruct Item<A> {\n    opt: Option<A>,\n}\n\nimpl<A> Iterator for Item<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        match self.opt {\n            Some(_) => (1, Some(1)),\n            None => (0, Some(0)),\n        }\n    }\n}\n\nimpl<A> DoubleEndedIterator for Item<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.opt.take()\n    }\n}\n\nimpl<A> ExactSizeIterator for Item<A> {}\nimpl<A> FusedIterator for Item<A> {}\nunsafe impl<A> TrustedLen for Item<A> {}\n\n/// An iterator over a reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct Iter<'a, A: 'a> {\n    inner: Item<&'a A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for Iter<'a, A> {\n    type Item = &'a A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for Iter<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for Iter<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for Iter<'_, A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for Iter<'_, A> {}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Clone for Iter<'_, A> {\n    #[inline]\n    fn clone(&self) -> Self {\n        Iter { inner: self.inner.clone() }\n    }\n}\n\n/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::iter_mut`] function.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\n#[derive(Debug)]\npub struct IterMut<'a, A: 'a> {\n    inner: Item<&'a mut A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> Iterator for IterMut<'a, A> {\n    type Item = &'a mut A;\n\n    #[inline]\n    fn next(&mut self) -> Option<&'a mut A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<'a, A> DoubleEndedIterator for IterMut<'a, A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<&'a mut A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IterMut<'_, A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IterMut<'_, A> {}\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IterMut<'_, A> {}\n\n/// An iterator over the value in [`Some`] variant of an [`Option`].\n///\n/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.\n///\n/// This `struct` is created by the [`Option::into_iter`] function.\n#[derive(Clone, Debug)]\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub struct IntoIter<A> {\n    inner: Item<A>,\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> Iterator for IntoIter<A> {\n    type Item = A;\n\n    #[inline]\n    fn next(&mut self) -> Option<A> {\n        self.inner.next()\n    }\n    #[inline]\n    fn size_hint(&self) -> (usize, Option<usize>) {\n        self.inner.size_hint()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> DoubleEndedIterator for IntoIter<A> {\n    #[inline]\n    fn next_back(&mut self) -> Option<A> {\n        self.inner.next_back()\n    }\n}\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A> ExactSizeIterator for IntoIter<A> {}\n\n#[stable(feature = \"fused\", since = \"1.26.0\")]\nimpl<A> FusedIterator for IntoIter<A> {}\n\n#[unstable(feature = \"trusted_len\", issue = \"37572\")]\nunsafe impl<A> TrustedLen for IntoIter<A> {}\n\n/////////////////////////////////////////////////////////////////////////////\n// FromIterator\n/////////////////////////////////////////////////////////////////////////////\n\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\nimpl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {\n    /// Takes each element in the [`Iterator`]: if it is [`None`][Option::None],\n    /// no further elements are taken, and the [`None`][Option::None] is\n    /// returned. Should no [`None`][Option::None] occur, a container of type\n    /// `V` containing the values of each [`Option`] is returned.\n    ///\n    /// # Examples\n    ///\n    /// Here is an example which increments every integer in a vector.\n    /// We use the checked variant of `add` that returns `None` when the\n    /// calculation would result in an overflow.\n    ///\n    /// ```\n    /// let items = vec![0_u16, 1, 2];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_add(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, Some(vec![1, 2, 3]));\n    /// ```\n    ///\n    /// As you can see, this will return the expected, valid items.\n    ///\n    /// Here is another example that tries to subtract one from another list\n    /// of integers, this time checking for underflow:\n    ///\n    /// ```\n    /// let items = vec![2_u16, 1, 0];\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| x.checked_sub(1))\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// ```\n    ///\n    /// Since the last element is zero, it would underflow. Thus, the resulting\n    /// value is `None`.\n    ///\n    /// Here is a variation on the previous example, showing that no\n    /// further elements are taken from `iter` after the first `None`.\n    ///\n    /// ```\n    /// let items = vec![3_u16, 2, 1, 10];\n    ///\n    /// let mut shared = 0;\n    ///\n    /// let res: Option<Vec<u16>> = items\n    ///     .iter()\n    ///     .map(|x| { shared += x; x.checked_sub(2) })\n    ///     .collect();\n    ///\n    /// assert_eq!(res, None);\n    /// assert_eq!(shared, 6);\n    /// ```\n    ///\n    /// Since the third element caused an underflow, no further elements were taken,\n    /// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.\n    #[inline]\n    fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {\n        // FIXME(#11084): This could be replaced with Iterator::scan when this\n        // performance bug is closed.\n\n        iter::try_process(iter.into_iter(), |i| i.collect())\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::Try for Option<T> {\n    type Output = T;\n    type Residual = Option<convert::Infallible>;\n\n    #[inline]\n    fn from_output(output: Self::Output) -> Self {\n        Some(output)\n    }\n\n    #[inline]\n    fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {\n        match self {\n            Some(v) => ControlFlow::Continue(v),\n            None => ControlFlow::Break(None),\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2\", issue = \"84277\")]\n#[rustc_const_unstable(feature = \"const_convert\", issue = \"88674\")]\nimpl<T> const ops::FromResidual for Option<T> {\n    #[inline]\n    fn from_residual(residual: Option<convert::Infallible>) -> Self {\n        match residual {\n            None => None,\n        }\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_yeet\", issue = \"96374\")]\nimpl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {\n    #[inline]\n    fn from_residual(ops::Yeet(()): ops::Yeet<()>) -> Self {\n        None\n    }\n}\n\n#[unstable(feature = \"try_trait_v2_residual\", issue = \"91285\")]\nimpl<T> ops::Residual<T> for Option<convert::Infallible> {\n    type TryType = Option<T>;\n}\n\nimpl<T> Option<Option<T>> {\n    /// Converts from `Option<Option<T>>` to `Option<T>`.\n    ///\n    /// # Examples\n    ///\n    /// Basic usage:\n    ///\n    /// ```\n    /// let x: Option<Option<u32>> = Some(Some(6));\n    /// assert_eq!(Some(6), x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = Some(None);\n    /// assert_eq!(None, x.flatten());\n    ///\n    /// let x: Option<Option<u32>> = None;\n    /// assert_eq!(None, x.flatten());\n    /// ```\n    ///\n    /// Flattening only removes one level of nesting at a time:\n    ///\n    /// ```\n    /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));\n    /// assert_eq!(Some(Some(6)), x.flatten());\n    /// assert_eq!(Some(6), x.flatten().flatten());\n    /// ```\n    #[inline]\n    #[stable(feature = \"option_flattening\", since = \"1.40.0\")]\n    #[rustc_const_unstable(feature = \"const_option\", issue = \"67441\")]\n    pub const fn flatten(self) -> Option<T> {\n        match self {\n            Some(inner) => inner,\n            None => None,\n        }\n    }\n}\n","uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","version":0}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}},"id":3}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":3,"result":[{"range":{"start":{"line":537,"character":4},"end":{"line":554,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::is_some","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":537,"character":4},"end":{"line":554,"character":5}},"targetSelectionRange":{"start":{"line":537,"character":4},"end":{"line":554,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some","--nocapture"]}}]}},{"range":{"start":{"line":556,"character":4},"end":{"line":577,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::is_some_and","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":556,"character":4},"end":{"line":577,"character":5}},"targetSelectionRange":{"start":{"line":556,"character":4},"end":{"line":577,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some_and","--nocapture"]}}]}},{"range":{"start":{"line":579,"character":4},"end":{"line":597,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::is_none","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":579,"character":4},"end":{"line":597,"character":5}},"targetSelectionRange":{"start":{"line":579,"character":4},"end":{"line":597,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_none","--nocapture"]}}]}},{"range":{"start":{"line":603,"character":4},"end":{"line":630,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_ref","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":603,"character":4},"end":{"line":630,"character":5}},"targetSelectionRange":{"start":{"line":603,"character":4},"end":{"line":630,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_ref","--nocapture"]}}]}},{"range":{"start":{"line":632,"character":4},"end":{"line":652,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_mut","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":632,"character":4},"end":{"line":652,"character":5}},"targetSelectionRange":{"start":{"line":632,"character":4},"end":{"line":652,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_mut","--nocapture"]}}]}},{"range":{"start":{"line":692,"character":4},"end":{"line":739,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::expect","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":692,"character":4},"end":{"line":739,"character":5}},"targetSelectionRange":{"start":{"line":692,"character":4},"end":{"line":739,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::expect","--nocapture"]}}]}},{"range":{"start":{"line":741,"character":4},"end":{"line":776,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":741,"character":4},"end":{"line":776,"character":5}},"targetSelectionRange":{"start":{"line":741,"character":4},"end":{"line":776,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap","--nocapture"]}}]}},{"range":{"start":{"line":778,"character":4},"end":{"line":803,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":778,"character":4},"end":{"line":803,"character":5}},"targetSelectionRange":{"start":{"line":778,"character":4},"end":{"line":803,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or","--nocapture"]}}]}},{"range":{"start":{"line":805,"character":4},"end":{"line":826,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":805,"character":4},"end":{"line":826,"character":5}},"targetSelectionRange":{"start":{"line":805,"character":4},"end":{"line":826,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_else","--nocapture"]}}]}},{"range":{"start":{"line":828,"character":4},"end":{"line":865,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_or_default","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":828,"character":4},"end":{"line":865,"character":5}},"targetSelectionRange":{"start":{"line":828,"character":4},"end":{"line":865,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_default","--nocapture"]}}]}},{"range":{"start":{"line":867,"character":4},"end":{"line":898,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::unwrap_unchecked","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":867,"character":4},"end":{"line":898,"character":5}},"targetSelectionRange":{"start":{"line":867,"character":4},"end":{"line":898,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_unchecked","--nocapture"]}}]}},{"range":{"start":{"line":904,"character":4},"end":{"line":931,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::map","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":904,"character":4},"end":{"line":931,"character":5}},"targetSelectionRange":{"start":{"line":904,"character":4},"end":{"line":931,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map","--nocapture"]}}]}},{"range":{"start":{"line":933,"character":4},"end":{"line":961,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::inspect","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":933,"character":4},"end":{"line":961,"character":5}},"targetSelectionRange":{"start":{"line":933,"character":4},"end":{"line":961,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::inspect","--nocapture"]}}]}},{"range":{"start":{"line":963,"character":4},"end":{"line":994,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::map_or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":963,"character":4},"end":{"line":994,"character":5}},"targetSelectionRange":{"start":{"line":963,"character":4},"end":{"line":994,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or","--nocapture"]}}]}},{"range":{"start":{"line":996,"character":4},"end":{"line":1024,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::map_or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":996,"character":4},"end":{"line":1024,"character":5}},"targetSelectionRange":{"start":{"line":996,"character":4},"end":{"line":1024,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or_else","--nocapture"]}}]}},{"range":{"start":{"line":1026,"character":4},"end":{"line":1058,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::ok_or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1026,"character":4},"end":{"line":1058,"character":5}},"targetSelectionRange":{"start":{"line":1026,"character":4},"end":{"line":1058,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or","--nocapture"]}}]}},{"range":{"start":{"line":1060,"character":4},"end":{"line":1088,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::ok_or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1060,"character":4},"end":{"line":1088,"character":5}},"targetSelectionRange":{"start":{"line":1060,"character":4},"end":{"line":1088,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or_else","--nocapture"]}}]}},{"range":{"start":{"line":1090,"character":4},"end":{"line":1114,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_deref","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1090,"character":4},"end":{"line":1114,"character":5}},"targetSelectionRange":{"start":{"line":1090,"character":4},"end":{"line":1114,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref","--nocapture"]}}]}},{"range":{"start":{"line":1116,"character":4},"end":{"line":1140,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::as_deref_mut","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1116,"character":4},"end":{"line":1140,"character":5}},"targetSelectionRange":{"start":{"line":1116,"character":4},"end":{"line":1140,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref_mut","--nocapture"]}}]}},{"range":{"start":{"line":1146,"character":4},"end":{"line":1162,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::iter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1146,"character":4},"end":{"line":1162,"character":5}},"targetSelectionRange":{"start":{"line":1146,"character":4},"end":{"line":1162,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter","--nocapture"]}}]}},{"range":{"start":{"line":1164,"character":4},"end":{"line":1183,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::iter_mut","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1164,"character":4},"end":{"line":1183,"character":5}},"targetSelectionRange":{"start":{"line":1164,"character":4},"end":{"line":1183,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter_mut","--nocapture"]}}]}},{"range":{"start":{"line":1189,"character":4},"end":{"line":1222,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::and","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1189,"character":4},"end":{"line":1222,"character":5}},"targetSelectionRange":{"start":{"line":1189,"character":4},"end":{"line":1222,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and","--nocapture"]}}]}},{"range":{"start":{"line":1224,"character":4},"end":{"line":1264,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::and_then","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1224,"character":4},"end":{"line":1264,"character":5}},"targetSelectionRange":{"start":{"line":1224,"character":4},"end":{"line":1264,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and_then","--nocapture"]}}]}},{"range":{"start":{"line":1266,"character":4},"end":{"line":1305,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::filter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1266,"character":4},"end":{"line":1305,"character":5}},"targetSelectionRange":{"start":{"line":1266,"character":4},"end":{"line":1305,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::filter","--nocapture"]}}]}},{"range":{"start":{"line":1307,"character":4},"end":{"line":1345,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::or","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1307,"character":4},"end":{"line":1345,"character":5}},"targetSelectionRange":{"start":{"line":1307,"character":4},"end":{"line":1345,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or","--nocapture"]}}]}},{"range":{"start":{"line":1347,"character":4},"end":{"line":1372,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::or_else","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1347,"character":4},"end":{"line":1372,"character":5}},"targetSelectionRange":{"start":{"line":1347,"character":4},"end":{"line":1372,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or_else","--nocapture"]}}]}},{"range":{"start":{"line":1374,"character":4},"end":{"line":1407,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::xor","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1374,"character":4},"end":{"line":1407,"character":5}},"targetSelectionRange":{"start":{"line":1374,"character":4},"end":{"line":1407,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::xor","--nocapture"]}}]}},{"range":{"start":{"line":1413,"character":4},"end":{"line":1444,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::insert","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1413,"character":4},"end":{"line":1444,"character":5}},"targetSelectionRange":{"start":{"line":1413,"character":4},"end":{"line":1444,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::insert","--nocapture"]}}]}},{"range":{"start":{"line":1446,"character":4},"end":{"line":1480,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::get_or_insert","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1446,"character":4},"end":{"line":1480,"character":5}},"targetSelectionRange":{"start":{"line":1446,"character":4},"end":{"line":1480,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert","--nocapture"]}}]}},{"range":{"start":{"line":1482,"character":4},"end":{"line":1513,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::get_or_insert_default","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1482,"character":4},"end":{"line":1513,"character":5}},"targetSelectionRange":{"start":{"line":1482,"character":4},"end":{"line":1513,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_default","--nocapture"]}}]}},{"range":{"start":{"line":1515,"character":4},"end":{"line":1549,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::get_or_insert_with","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1515,"character":4},"end":{"line":1549,"character":5}},"targetSelectionRange":{"start":{"line":1515,"character":4},"end":{"line":1549,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_with","--nocapture"]}}]}},{"range":{"start":{"line":1555,"character":4},"end":{"line":1576,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::take","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1555,"character":4},"end":{"line":1576,"character":5}},"targetSelectionRange":{"start":{"line":1555,"character":4},"end":{"line":1576,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::take","--nocapture"]}}]}},{"range":{"start":{"line":1578,"character":4},"end":{"line":1600,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::replace","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1578,"character":4},"end":{"line":1600,"character":5}},"targetSelectionRange":{"start":{"line":1578,"character":4},"end":{"line":1600,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::replace","--nocapture"]}}]}},{"range":{"start":{"line":1602,"character":4},"end":{"line":1630,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::contains","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1602,"character":4},"end":{"line":1630,"character":5}},"targetSelectionRange":{"start":{"line":1602,"character":4},"end":{"line":1630,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::contains","--nocapture"]}}]}},{"range":{"start":{"line":1632,"character":4},"end":{"line":1658,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::zip","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1632,"character":4},"end":{"line":1658,"character":5}},"targetSelectionRange":{"start":{"line":1632,"character":4},"end":{"line":1658,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip","--nocapture"]}}]}},{"range":{"start":{"line":1660,"character":4},"end":{"line":1701,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::zip_with","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1660,"character":4},"end":{"line":1701,"character":5}},"targetSelectionRange":{"start":{"line":1660,"character":4},"end":{"line":1701,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip_with","--nocapture"]}}]}},{"range":{"start":{"line":1705,"character":4},"end":{"line":1728,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<(T,U)>::unzip","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1705,"character":4},"end":{"line":1728,"character":5}},"targetSelectionRange":{"start":{"line":1705,"character":4},"end":{"line":1728,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<(T,U)>::unzip","--nocapture"]}}]}},{"range":{"start":{"line":1732,"character":4},"end":{"line":1757,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&T>::copied","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1732,"character":4},"end":{"line":1757,"character":5}},"targetSelectionRange":{"start":{"line":1732,"character":4},"end":{"line":1757,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::copied","--nocapture"]}}]}},{"range":{"start":{"line":1759,"character":4},"end":{"line":1782,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&T>::cloned","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1759,"character":4},"end":{"line":1782,"character":5}},"targetSelectionRange":{"start":{"line":1759,"character":4},"end":{"line":1782,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::cloned","--nocapture"]}}]}},{"range":{"start":{"line":1786,"character":4},"end":{"line":1809,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&mutT>::copied","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1786,"character":4},"end":{"line":1809,"character":5}},"targetSelectionRange":{"start":{"line":1786,"character":4},"end":{"line":1809,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::copied","--nocapture"]}}]}},{"range":{"start":{"line":1811,"character":4},"end":{"line":1834,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&mutT>::cloned","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1811,"character":4},"end":{"line":1834,"character":5}},"targetSelectionRange":{"start":{"line":1811,"character":4},"end":{"line":1834,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::cloned","--nocapture"]}}]}},{"range":{"start":{"line":1838,"character":4},"end":{"line":1863,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<Result<T,E>>::transpose","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1838,"character":4},"end":{"line":1863,"character":5}},"targetSelectionRange":{"start":{"line":1838,"character":4},"end":{"line":1863,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Result<T,E>>::transpose","--nocapture"]}}]}},{"range":{"start":{"line":1906,"character":4},"end":{"line":1917,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::default","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1906,"character":4},"end":{"line":1917,"character":5}},"targetSelectionRange":{"start":{"line":1906,"character":4},"end":{"line":1917,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::default","--nocapture"]}}]}},{"range":{"start":{"line":1925,"character":4},"end":{"line":1941,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::into_iter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1925,"character":4},"end":{"line":1941,"character":5}},"targetSelectionRange":{"start":{"line":1925,"character":4},"end":{"line":1941,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::into_iter","--nocapture"]}}]}},{"range":{"start":{"line":1967,"character":4},"end":{"line":1978,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<T>::from","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1967,"character":4},"end":{"line":1978,"character":5}},"targetSelectionRange":{"start":{"line":1967,"character":4},"end":{"line":1978,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::from","--nocapture"]}}]}},{"range":{"start":{"line":1984,"character":4},"end":{"line":2006,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&T>::from","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":1984,"character":4},"end":{"line":2006,"character":5}},"targetSelectionRange":{"start":{"line":1984,"character":4},"end":{"line":2006,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::from","--nocapture"]}}]}},{"range":{"start":{"line":2012,"character":4},"end":{"line":2029,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<&mutT>::from","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":2012,"character":4},"end":{"line":2029,"character":5}},"targetSelectionRange":{"start":{"line":2012,"character":4},"end":{"line":2029,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::from","--nocapture"]}}]}},{"range":{"start":{"line":2208,"character":4},"end":{"line":2274,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<V>::from_iter","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":2208,"character":4},"end":{"line":2274,"character":5}},"targetSelectionRange":{"start":{"line":2208,"character":4},"end":{"line":2274,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<V>::from_iter","--nocapture"]}}]}},{"range":{"start":{"line":2322,"character":4},"end":{"line":2354,"character":5}},"command":{"title":"▶︎ Run Doctest","command":"rust-analyzer.runSingle","arguments":[{"label":"doctest option::Option<Option<T>>::flatten","location":{"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","targetRange":{"start":{"line":2322,"character":4},"end":{"line":2354,"character":5}},"targetSelectionRange":{"start":{"line":2322,"character":4},"end":{"line":2354,"character":5}}},"kind":"cargo","args":{"overrideCargo":null,"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Option<T>>::flatten","--nocapture"]}}]}},{"range":{"start":{"line":517,"character":9},"end":{"line":517,"character":15}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":517,"character":9}}}},{"range":{"start":{"line":2037,"character":7},"end":{"line":2037,"character":11}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2037,"character":7}}}},{"range":{"start":{"line":2076,"character":11},"end":{"line":2076,"character":15}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2076,"character":11}}}},{"range":{"start":{"line":2126,"character":11},"end":{"line":2126,"character":18}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2126,"character":11}}}},{"range":{"start":{"line":2167,"character":11},"end":{"line":2167,"character":19}},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2167,"character":11}}}}]}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":9,"line":517},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":517},"start":{"character":9,"line":517}}},"id":4}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":4,"result":{"range":{"start":{"line":517,"character":9},"end":{"line":517,"character":15}},"command":{"title":"75 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":517,"character":9},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":532,"character":0},"end":{"line":1702,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1704,"character":0},"end":{"line":1729,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1731,"character":0},"end":{"line":1783,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1785,"character":0},"end":{"line":1835,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1837,"character":0},"end":{"line":1864,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2321,"character":0},"end":{"line":2355,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":72,"character":0},"end":{"line":77,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":79,"character":0},"end":{"line":84,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs","range":{"start":{"line":104,"character":0},"end":{"line":117,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2297,"character":0},"end":{"line":2306,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2308,"character":0},"end":{"line":2314,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2206,"character":0},"end":{"line":2275,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1964,"character":0},"end":{"line":1979,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1981,"character":0},"end":{"line":2007,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2009,"character":0},"end":{"line":2030,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1880,"character":0},"end":{"line":1901,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2277,"character":0},"end":{"line":2295,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs","range":{"start":{"line":216,"character":0},"end":{"line":230,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2316,"character":0},"end":{"line":2319,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1920,"character":0},"end":{"line":1942,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1944,"character":0},"end":{"line":1952,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1954,"character":0},"end":{"line":1962,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs","range":{"start":{"line":149,"character":0},"end":{"line":157,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs","range":{"start":{"line":198,"character":0},"end":{"line":215,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs","range":{"start":{"line":189,"character":0},"end":{"line":214,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":1903,"character":0},"end":{"line":1918,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":514,"character":0},"end":{"line":514,"character":60}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs","range":{"start":{"line":421,"character":0},"end":{"line":426,"character":2}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs","range":{"start":{"line":175,"character":4},"end":{"line":175,"character":35}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs","range":{"start":{"line":61,"character":0},"end":{"line":96,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/arc-swap-0.4.7/src/ref_cnt.rs","range":{"start":{"line":112,"character":0},"end":{"line":127,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/option.rs","range":{"start":{"line":4,"character":0},"end":{"line":14,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/calls.rs","range":{"start":{"line":9,"character":0},"end":{"line":9,"character":43}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/io.rs","range":{"start":{"line":380,"character":0},"end":{"line":386,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.10.2/src/util.rs","range":{"start":{"line":14,"character":0},"end":{"line":22,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.7.2/src/util.rs","range":{"start":{"line":12,"character":0},"end":{"line":20,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs","range":{"start":{"line":108,"character":0},"end":{"line":114,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs","range":{"start":{"line":635,"character":0},"end":{"line":653,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/ser/impls.rs","range":{"start":{"line":98,"character":0},"end":{"line":112,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/expr.rs","range":{"start":{"line":2463,"character":4},"end":{"line":2472,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs","range":{"start":{"line":647,"character":4},"end":{"line":655,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs","range":{"start":{"line":811,"character":4},"end":{"line":819,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/ty.rs","range":{"start":{"line":1057,"character":4},"end":{"line":1065,"character":5}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/parse.rs","range":{"start":{"line":1037,"character":0},"end":{"line":1045,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":517,"character":9}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":7,"line":2037},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":11,"line":2037},"start":{"character":7,"line":2037}}},"id":5}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":5,"result":{"range":{"start":{"line":2037,"character":7},"end":{"line":2037,"character":11}},"command":{"title":"7 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2037,"character":7},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2036,"character":0},"end":{"line":2036,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2041,"character":0},"end":{"line":2056,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2067,"character":0},"end":{"line":2067,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2036,"character":0},"end":{"line":2036,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2065,"character":0},"end":{"line":2065,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2066,"character":0},"end":{"line":2066,"character":36}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2058,"character":0},"end":{"line":2063,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2037,"character":7}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":11,"line":2076},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":2076},"start":{"character":11,"line":2076}}},"id":6}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":6,"result":{"range":{"start":{"line":2076,"character":11},"end":{"line":2076,"character":15}},"command":{"title":"8 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2076,"character":11},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2075,"character":0},"end":{"line":2075,"character":16}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2080,"character":0},"end":{"line":2092,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2108,"character":0},"end":{"line":2109,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2111,"character":0},"end":{"line":2117,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2102,"character":0},"end":{"line":2103,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2105,"character":0},"end":{"line":2106,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2094,"character":0},"end":{"line":2100,"character":1}}},{"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.9.0/src/peeking_take_while.rs","range":{"start":{"line":137,"character":0},"end":{"line":137,"character":61}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2076,"character":11}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":11,"line":2126},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":18,"line":2126},"start":{"character":11,"line":2126}}},"id":7}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":7,"result":{"range":{"start":{"line":2126,"character":11},"end":{"line":2126,"character":18}},"command":{"title":"6 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2126,"character":11},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2125,"character":0},"end":{"line":2125,"character":16}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2130,"character":0},"end":{"line":2142,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2157,"character":0},"end":{"line":2158,"character":47}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2152,"character":0},"end":{"line":2153,"character":47}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2155,"character":0},"end":{"line":2156,"character":43}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2144,"character":0},"end":{"line":2150,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2126,"character":11}}}}}
17:00:16 DEBUG writer-Some("rust") src/rpcclient.rs:254 => Some("rust") {"jsonrpc":"2.0","method":"codeLens/resolve","params":{"data":{"impls":{"position":{"character":11,"line":2167},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":19,"line":2167},"start":{"character":11,"line":2167}}},"id":8}
17:00:16 DEBUG reader-Some("rust") src/rpcclient.rs:207 <= Some("rust") {"jsonrpc":"2.0","id":8,"result":{"range":{"start":{"line":2167,"character":11},"end":{"line":2167,"character":19}},"command":{"title":"7 implementations","command":"rust-analyzer.showReferences","arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"line":2167,"character":11},[{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2165,"character":0},"end":{"line":2165,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2171,"character":0},"end":{"line":2183,"character":1}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2199,"character":0},"end":{"line":2200,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2165,"character":0},"end":{"line":2165,"character":23}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2193,"character":0},"end":{"line":2194,"character":44}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2196,"character":0},"end":{"line":2197,"character":40}}},{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs","range":{"start":{"line":2185,"character":0},"end":{"line":2191,"character":1}}}]]},"data":{"impls":{"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},"position":{"line":2167,"character":11}}}}}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.code_lens./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> [{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::is_some","location":{"targetRange":{"end":{"character":5,"line":554},"start":{"character":4,"line":537}},"targetSelectionRange":{"end":{"character":5,"line":554},"start":{"character":4,"line":537}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":554},"start":{"character":4,"line":537}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_some_and","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::is_some_and","location":{"targetRange":{"end":{"character":5,"line":577},"start":{"character":4,"line":556}},"targetSelectionRange":{"end":{"character":5,"line":577},"start":{"character":4,"line":556}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":577},"start":{"character":4,"line":556}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::is_none","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::is_none","location":{"targetRange":{"end":{"character":5,"line":597},"start":{"character":4,"line":579}},"targetSelectionRange":{"end":{"character":5,"line":597},"start":{"character":4,"line":579}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":597},"start":{"character":4,"line":579}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_ref","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_ref","location":{"targetRange":{"end":{"character":5,"line":630},"start":{"character":4,"line":603}},"targetSelectionRange":{"end":{"character":5,"line":630},"start":{"character":4,"line":603}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":630},"start":{"character":4,"line":603}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_mut","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_mut","location":{"targetRange":{"end":{"character":5,"line":652},"start":{"character":4,"line":632}},"targetSelectionRange":{"end":{"character":5,"line":652},"start":{"character":4,"line":632}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":652},"start":{"character":4,"line":632}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::expect","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::expect","location":{"targetRange":{"end":{"character":5,"line":739},"start":{"character":4,"line":692}},"targetSelectionRange":{"end":{"character":5,"line":739},"start":{"character":4,"line":692}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":739},"start":{"character":4,"line":692}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap","location":{"targetRange":{"end":{"character":5,"line":776},"start":{"character":4,"line":741}},"targetSelectionRange":{"end":{"character":5,"line":776},"start":{"character":4,"line":741}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":776},"start":{"character":4,"line":741}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_or","location":{"targetRange":{"end":{"character":5,"line":803},"start":{"character":4,"line":778}},"targetSelectionRange":{"end":{"character":5,"line":803},"start":{"character":4,"line":778}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":803},"start":{"character":4,"line":778}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_or_else","location":{"targetRange":{"end":{"character":5,"line":826},"start":{"character":4,"line":805}},"targetSelectionRange":{"end":{"character":5,"line":826},"start":{"character":4,"line":805}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":826},"start":{"character":4,"line":805}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_or_default","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_or_default","location":{"targetRange":{"end":{"character":5,"line":865},"start":{"character":4,"line":828}},"targetSelectionRange":{"end":{"character":5,"line":865},"start":{"character":4,"line":828}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":865},"start":{"character":4,"line":828}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::unwrap_unchecked","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::unwrap_unchecked","location":{"targetRange":{"end":{"character":5,"line":898},"start":{"character":4,"line":867}},"targetSelectionRange":{"end":{"character":5,"line":898},"start":{"character":4,"line":867}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":898},"start":{"character":4,"line":867}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::map","location":{"targetRange":{"end":{"character":5,"line":931},"start":{"character":4,"line":904}},"targetSelectionRange":{"end":{"character":5,"line":931},"start":{"character":4,"line":904}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":931},"start":{"character":4,"line":904}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::inspect","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::inspect","location":{"targetRange":{"end":{"character":5,"line":961},"start":{"character":4,"line":933}},"targetSelectionRange":{"end":{"character":5,"line":961},"start":{"character":4,"line":933}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":961},"start":{"character":4,"line":933}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::map_or","location":{"targetRange":{"end":{"character":5,"line":994},"start":{"character":4,"line":963}},"targetSelectionRange":{"end":{"character":5,"line":994},"start":{"character":4,"line":963}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":994},"start":{"character":4,"line":963}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::map_or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::map_or_else","location":{"targetRange":{"end":{"character":5,"line":1024},"start":{"character":4,"line":996}},"targetSelectionRange":{"end":{"character":5,"line":1024},"start":{"character":4,"line":996}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1024},"start":{"character":4,"line":996}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::ok_or","location":{"targetRange":{"end":{"character":5,"line":1058},"start":{"character":4,"line":1026}},"targetSelectionRange":{"end":{"character":5,"line":1058},"start":{"character":4,"line":1026}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1058},"start":{"character":4,"line":1026}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::ok_or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::ok_or_else","location":{"targetRange":{"end":{"character":5,"line":1088},"start":{"character":4,"line":1060}},"targetSelectionRange":{"end":{"character":5,"line":1088},"start":{"character":4,"line":1060}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1088},"start":{"character":4,"line":1060}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_deref","location":{"targetRange":{"end":{"character":5,"line":1114},"start":{"character":4,"line":1090}},"targetSelectionRange":{"end":{"character":5,"line":1114},"start":{"character":4,"line":1090}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1114},"start":{"character":4,"line":1090}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::as_deref_mut","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::as_deref_mut","location":{"targetRange":{"end":{"character":5,"line":1140},"start":{"character":4,"line":1116}},"targetSelectionRange":{"end":{"character":5,"line":1140},"start":{"character":4,"line":1116}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1140},"start":{"character":4,"line":1116}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::iter","location":{"targetRange":{"end":{"character":5,"line":1162},"start":{"character":4,"line":1146}},"targetSelectionRange":{"end":{"character":5,"line":1162},"start":{"character":4,"line":1146}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1162},"start":{"character":4,"line":1146}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::iter_mut","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::iter_mut","location":{"targetRange":{"end":{"character":5,"line":1183},"start":{"character":4,"line":1164}},"targetSelectionRange":{"end":{"character":5,"line":1183},"start":{"character":4,"line":1164}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1183},"start":{"character":4,"line":1164}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::and","location":{"targetRange":{"end":{"character":5,"line":1222},"start":{"character":4,"line":1189}},"targetSelectionRange":{"end":{"character":5,"line":1222},"start":{"character":4,"line":1189}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1222},"start":{"character":4,"line":1189}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::and_then","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::and_then","location":{"targetRange":{"end":{"character":5,"line":1264},"start":{"character":4,"line":1224}},"targetSelectionRange":{"end":{"character":5,"line":1264},"start":{"character":4,"line":1224}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1264},"start":{"character":4,"line":1224}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::filter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::filter","location":{"targetRange":{"end":{"character":5,"line":1305},"start":{"character":4,"line":1266}},"targetSelectionRange":{"end":{"character":5,"line":1305},"start":{"character":4,"line":1266}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1305},"start":{"character":4,"line":1266}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::or","location":{"targetRange":{"end":{"character":5,"line":1345},"start":{"character":4,"line":1307}},"targetSelectionRange":{"end":{"character":5,"line":1345},"start":{"character":4,"line":1307}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1345},"start":{"character":4,"line":1307}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::or_else","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::or_else","location":{"targetRange":{"end":{"character":5,"line":1372},"start":{"character":4,"line":1347}},"targetSelectionRange":{"end":{"character":5,"line":1372},"start":{"character":4,"line":1347}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1372},"start":{"character":4,"line":1347}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::xor","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::xor","location":{"targetRange":{"end":{"character":5,"line":1407},"start":{"character":4,"line":1374}},"targetSelectionRange":{"end":{"character":5,"line":1407},"start":{"character":4,"line":1374}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1407},"start":{"character":4,"line":1374}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::insert","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::insert","location":{"targetRange":{"end":{"character":5,"line":1444},"start":{"character":4,"line":1413}},"targetSelectionRange":{"end":{"character":5,"line":1444},"start":{"character":4,"line":1413}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1444},"start":{"character":4,"line":1413}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::get_or_insert","location":{"targetRange":{"end":{"character":5,"line":1480},"start":{"character":4,"line":1446}},"targetSelectionRange":{"end":{"character":5,"line":1480},"start":{"character":4,"line":1446}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1480},"start":{"character":4,"line":1446}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_default","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::get_or_insert_default","location":{"targetRange":{"end":{"character":5,"line":1513},"start":{"character":4,"line":1482}},"targetSelectionRange":{"end":{"character":5,"line":1513},"start":{"character":4,"line":1482}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1513},"start":{"character":4,"line":1482}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::get_or_insert_with","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::get_or_insert_with","location":{"targetRange":{"end":{"character":5,"line":1549},"start":{"character":4,"line":1515}},"targetSelectionRange":{"end":{"character":5,"line":1549},"start":{"character":4,"line":1515}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1549},"start":{"character":4,"line":1515}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::take","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::take","location":{"targetRange":{"end":{"character":5,"line":1576},"start":{"character":4,"line":1555}},"targetSelectionRange":{"end":{"character":5,"line":1576},"start":{"character":4,"line":1555}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1576},"start":{"character":4,"line":1555}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::replace","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::replace","location":{"targetRange":{"end":{"character":5,"line":1600},"start":{"character":4,"line":1578}},"targetSelectionRange":{"end":{"character":5,"line":1600},"start":{"character":4,"line":1578}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1600},"start":{"character":4,"line":1578}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::contains","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::contains","location":{"targetRange":{"end":{"character":5,"line":1630},"start":{"character":4,"line":1602}},"targetSelectionRange":{"end":{"character":5,"line":1630},"start":{"character":4,"line":1602}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1630},"start":{"character":4,"line":1602}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::zip","location":{"targetRange":{"end":{"character":5,"line":1658},"start":{"character":4,"line":1632}},"targetSelectionRange":{"end":{"character":5,"line":1658},"start":{"character":4,"line":1632}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1658},"start":{"character":4,"line":1632}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::zip_with","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::zip_with","location":{"targetRange":{"end":{"character":5,"line":1701},"start":{"character":4,"line":1660}},"targetSelectionRange":{"end":{"character":5,"line":1701},"start":{"character":4,"line":1660}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1701},"start":{"character":4,"line":1660}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<(T,U)>::unzip","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<(T,U)>::unzip","location":{"targetRange":{"end":{"character":5,"line":1728},"start":{"character":4,"line":1705}},"targetSelectionRange":{"end":{"character":5,"line":1728},"start":{"character":4,"line":1705}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1728},"start":{"character":4,"line":1705}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::copied","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&T>::copied","location":{"targetRange":{"end":{"character":5,"line":1757},"start":{"character":4,"line":1732}},"targetSelectionRange":{"end":{"character":5,"line":1757},"start":{"character":4,"line":1732}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1757},"start":{"character":4,"line":1732}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::cloned","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&T>::cloned","location":{"targetRange":{"end":{"character":5,"line":1782},"start":{"character":4,"line":1759}},"targetSelectionRange":{"end":{"character":5,"line":1782},"start":{"character":4,"line":1759}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1782},"start":{"character":4,"line":1759}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::copied","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&mutT>::copied","location":{"targetRange":{"end":{"character":5,"line":1809},"start":{"character":4,"line":1786}},"targetSelectionRange":{"end":{"character":5,"line":1809},"start":{"character":4,"line":1786}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1809},"start":{"character":4,"line":1786}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::cloned","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&mutT>::cloned","location":{"targetRange":{"end":{"character":5,"line":1834},"start":{"character":4,"line":1811}},"targetSelectionRange":{"end":{"character":5,"line":1834},"start":{"character":4,"line":1811}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1834},"start":{"character":4,"line":1811}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Result<T,E>>::transpose","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<Result<T,E>>::transpose","location":{"targetRange":{"end":{"character":5,"line":1863},"start":{"character":4,"line":1838}},"targetSelectionRange":{"end":{"character":5,"line":1863},"start":{"character":4,"line":1838}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1863},"start":{"character":4,"line":1838}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::default","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::default","location":{"targetRange":{"end":{"character":5,"line":1917},"start":{"character":4,"line":1906}},"targetSelectionRange":{"end":{"character":5,"line":1917},"start":{"character":4,"line":1906}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1917},"start":{"character":4,"line":1906}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::into_iter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::into_iter","location":{"targetRange":{"end":{"character":5,"line":1941},"start":{"character":4,"line":1925}},"targetSelectionRange":{"end":{"character":5,"line":1941},"start":{"character":4,"line":1925}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1941},"start":{"character":4,"line":1925}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<T>::from","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<T>::from","location":{"targetRange":{"end":{"character":5,"line":1978},"start":{"character":4,"line":1967}},"targetSelectionRange":{"end":{"character":5,"line":1978},"start":{"character":4,"line":1967}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":1978},"start":{"character":4,"line":1967}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&T>::from","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&T>::from","location":{"targetRange":{"end":{"character":5,"line":2006},"start":{"character":4,"line":1984}},"targetSelectionRange":{"end":{"character":5,"line":2006},"start":{"character":4,"line":1984}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2006},"start":{"character":4,"line":1984}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<&mutT>::from","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<&mutT>::from","location":{"targetRange":{"end":{"character":5,"line":2029},"start":{"character":4,"line":2012}},"targetSelectionRange":{"end":{"character":5,"line":2029},"start":{"character":4,"line":2012}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2029},"start":{"character":4,"line":2012}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<V>::from_iter","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<V>::from_iter","location":{"targetRange":{"end":{"character":5,"line":2274},"start":{"character":4,"line":2208}},"targetSelectionRange":{"end":{"character":5,"line":2274},"start":{"character":4,"line":2208}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2274},"start":{"character":4,"line":2208}}},{"command":{"arguments":[{"args":{"cargoArgs":["test","--doc"],"cargoExtraArgs":[],"executableArgs":["option::Option<Option<T>>::flatten","--nocapture"],"overrideCargo":null},"kind":"cargo","label":"doctest option::Option<Option<T>>::flatten","location":{"targetRange":{"end":{"character":5,"line":2354},"start":{"character":4,"line":2322}},"targetSelectionRange":{"end":{"character":5,"line":2354},"start":{"character":4,"line":2322}},"targetUri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}],"command":"rust-analyzer.runSingle","title":"▶︎ Run Doctest"},"range":{"end":{"character":5,"line":2354},"start":{"character":4,"line":2322}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":9,"line":517},[{"range":{"end":{"character":1,"line":1702},"start":{"character":0,"line":532}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1729},"start":{"character":0,"line":1704}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1783},"start":{"character":0,"line":1731}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1835},"start":{"character":0,"line":1785}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1864},"start":{"character":0,"line":1837}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2355},"start":{"character":0,"line":2321}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":77},"start":{"character":0,"line":72}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":1,"line":84},"start":{"character":0,"line":79}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":2,"line":117},"start":{"character":0,"line":104}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/is_zero.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2306},"start":{"character":0,"line":2297}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2314},"start":{"character":0,"line":2308}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2275},"start":{"character":0,"line":2206}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1979},"start":{"character":0,"line":1964}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2007},"start":{"character":0,"line":1981}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2030},"start":{"character":0,"line":2009}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1901},"start":{"character":0,"line":1880}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2295},"start":{"character":0,"line":2277}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":230},"start":{"character":0,"line":216}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2319},"start":{"character":0,"line":2316}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1942},"start":{"character":0,"line":1920}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1952},"start":{"character":0,"line":1944}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":1962},"start":{"character":0,"line":1954}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":157},"start":{"character":0,"line":149}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/cmp.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":2,"line":215},"start":{"character":0,"line":198}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/array/equality.rs"},{"range":{"end":{"character":1,"line":214},"start":{"character":0,"line":189}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs"},{"range":{"end":{"character":1,"line":1918},"start":{"character":0,"line":1903}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":60,"line":514},"start":{"character":0,"line":514}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":2,"line":426},"start":{"character":0,"line":421}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/mod.rs"},{"range":{"end":{"character":35,"line":175},"start":{"character":4,"line":175}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs"},{"range":{"end":{"character":1,"line":96},"start":{"character":0,"line":61}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.32/src/context.rs"},{"range":{"end":{"character":1,"line":127},"start":{"character":0,"line":112}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/arc-swap-0.4.7/src/ref_cnt.rs"},{"range":{"end":{"character":1,"line":14},"start":{"character":0,"line":4}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/option.rs"},{"range":{"end":{"character":43,"line":9},"start":{"character":0,"line":9}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/calls.rs"},{"range":{"end":{"character":1,"line":386},"start":{"character":0,"line":380}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-15.1.0/src/io.rs"},{"range":{"end":{"character":1,"line":22},"start":{"character":0,"line":14}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.10.2/src/util.rs"},{"range":{"end":{"character":1,"line":20},"start":{"character":0,"line":12}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.7.2/src/util.rs"},{"range":{"end":{"character":1,"line":114},"start":{"character":0,"line":108}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs"},{"range":{"end":{"character":1,"line":653},"start":{"character":0,"line":635}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/de/impls.rs"},{"range":{"end":{"character":1,"line":112},"start":{"character":0,"line":98}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.114/src/ser/impls.rs"},{"range":{"end":{"character":5,"line":2472},"start":{"character":4,"line":2463}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/expr.rs"},{"range":{"end":{"character":5,"line":655},"start":{"character":4,"line":647}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs"},{"range":{"end":{"character":5,"line":819},"start":{"character":4,"line":811}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/generics.rs"},{"range":{"end":{"character":5,"line":1065},"start":{"character":4,"line":1057}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/ty.rs"},{"range":{"end":{"character":1,"line":1045},"start":{"character":0,"line":1037}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.35/src/parse.rs"}]],"command":"rust-analyzer.showReferences","title":"75 implementations"},"data":{"impls":{"position":{"character":9,"line":517},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":517},"start":{"character":9,"line":517}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":7,"line":2037},[{"range":{"end":{"character":23,"line":2036},"start":{"character":0,"line":2036}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2056},"start":{"character":0,"line":2041}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2067},"start":{"character":0,"line":2067}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":23,"line":2036},"start":{"character":0,"line":2036}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2065},"start":{"character":0,"line":2065}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":36,"line":2066},"start":{"character":0,"line":2066}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2063},"start":{"character":0,"line":2058}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}]],"command":"rust-analyzer.showReferences","title":"7 implementations"},"data":{"impls":{"position":{"character":7,"line":2037},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":11,"line":2037},"start":{"character":7,"line":2037}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":11,"line":2076},[{"range":{"end":{"character":16,"line":2075},"start":{"character":0,"line":2075}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2092},"start":{"character":0,"line":2080}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2109},"start":{"character":0,"line":2108}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2117},"start":{"character":0,"line":2111}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2103},"start":{"character":0,"line":2102}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2106},"start":{"character":0,"line":2105}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2100},"start":{"character":0,"line":2094}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":61,"line":137},"start":{"character":0,"line":137}},"uri":"file:///home/dick/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.9.0/src/peeking_take_while.rs"}]],"command":"rust-analyzer.showReferences","title":"8 implementations"},"data":{"impls":{"position":{"character":11,"line":2076},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":15,"line":2076},"start":{"character":11,"line":2076}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":11,"line":2126},[{"range":{"end":{"character":16,"line":2125},"start":{"character":0,"line":2125}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2142},"start":{"character":0,"line":2130}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":47,"line":2158},"start":{"character":0,"line":2157}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":47,"line":2153},"start":{"character":0,"line":2152}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":43,"line":2156},"start":{"character":0,"line":2155}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2150},"start":{"character":0,"line":2144}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}]],"command":"rust-analyzer.showReferences","title":"6 implementations"},"data":{"impls":{"position":{"character":11,"line":2126},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":18,"line":2126},"start":{"character":11,"line":2126}}},{"command":{"arguments":["file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",{"character":11,"line":2167},[{"range":{"end":{"character":23,"line":2165},"start":{"character":0,"line":2165}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2183},"start":{"character":0,"line":2171}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2200},"start":{"character":0,"line":2199}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":23,"line":2165},"start":{"character":0,"line":2165}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":44,"line":2194},"start":{"character":0,"line":2193}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":40,"line":2197},"start":{"character":0,"line":2196}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"},{"range":{"end":{"character":1,"line":2191},"start":{"character":0,"line":2185}},"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}]],"command":"rust-analyzer.showReferences","title":"7 implementations"},"data":{"impls":{"position":{"character":11,"line":2167},"textDocument":{"uri":"file:///home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}},"range":{"end":{"character":19,"line":2167},"start":{"character":11,"line":2167}}}]
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":31}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 31, "jsonrpc": "2.0", "result": "n"}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,0,22,[]],"id":32}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 32, "jsonrpc": "2.0", "result": 0}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.inlay_hints./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> []
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 1899, "start": 1877}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 1887}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:00:16 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(1887)}), "viewport": Object({"end": Number(1899), "start": Number(1877)})}) force_redraw=false
17:00:16 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 1887
17:00:16 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 1877, end: 1899 }
17:00:16 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> {"end":1899,"start":1877}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":33}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 33, "jsonrpc": "2.0", "result": 0}
17:00:16 DEBUG unnamed src/language_client.rs:108 state.highlights./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs: null ==> []
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":34}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 34, "jsonrpc": "2.0", "result": "n"}
17:00:16 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,1877,1899,[]],"id":35}
17:00:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 35, "jsonrpc": "2.0", "result": 0}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 22, "start": 0}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 0}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:21 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(0)}), "viewport": Object({"end": Number(22), "start": Number(0)})}) force_redraw=false
17:04:21 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 1887 ==> 0
17:04:21 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 0, end: 22 }
17:04:21 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 1877 ==> 0
17:04:21 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 1899 ==> 22
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":36}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 36, "jsonrpc": "2.0", "result": 0}
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":37}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 37, "jsonrpc": "2.0", "result": "n"}
17:04:21 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,0,22,[]],"id":38}
17:04:21 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 38, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 42, "start": 20}, "languageId": "rust", "buftype": "", "position": {"character": 2, "line": 20}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:30 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(2), "line": Number(20)}), "viewport": Object({"end": Number(42), "start": Number(20)})}) force_redraw=false
17:04:30 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 0 ==> 20
17:04:30 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 20, end: 42 }
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 22 ==> 42
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 0 ==> 20
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":39}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 39, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":40}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 40, "jsonrpc": "2.0", "result": "n"}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,20,42,[]],"id":41}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 41, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 62, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 6, "line": 40}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:30 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(6), "line": Number(40)}), "viewport": Object({"end": Number(62), "start": Number(40)})}) force_redraw=false
17:04:30 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 20 ==> 40
17:04:30 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 40, end: 62 }
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 42 ==> 62
17:04:30 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 20 ==> 40
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":42}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 42, "jsonrpc": "2.0", "result": 0}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":43}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 43, "jsonrpc": "2.0", "result": "n"}
17:04:30 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,40,62,[]],"id":44}
17:04:30 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 44, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 82, "start": 60}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 60}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:31 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(60)}), "viewport": Object({"end": Number(82), "start": Number(60)})}) force_redraw=false
17:04:31 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 40 ==> 60
17:04:31 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 60, end: 82 }
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 62 ==> 82
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 40 ==> 60
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":45}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 45, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":46}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 46, "jsonrpc": "2.0", "result": "n"}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,60,82,[]],"id":47}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 47, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 101, "start": 80}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 80}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:31 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(80)}), "viewport": Object({"end": Number(101), "start": Number(80)})}) force_redraw=false
17:04:31 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 60 ==> 80
17:04:31 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 80, end: 101 }
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 82 ==> 101
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 60 ==> 80
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":48}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 48, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":49}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 49, "jsonrpc": "2.0", "result": "n"}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,80,101,[]],"id":50}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 50, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 119, "start": 99}, "languageId": "rust", "buftype": "", "position": {"character": 2, "line": 99}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:31 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(2), "line": Number(99)}), "viewport": Object({"end": Number(119), "start": Number(99)})}) force_redraw=false
17:04:31 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 80 ==> 99
17:04:31 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 99, end: 119 }
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 101 ==> 119
17:04:31 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 80 ==> 99
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":51}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 51, "jsonrpc": "2.0", "result": 0}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":52}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 52, "jsonrpc": "2.0", "result": "n"}
17:04:31 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,99,119,[]],"id":53}
17:04:31 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 53, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 139, "start": 117}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 117}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:32 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(117)}), "viewport": Object({"end": Number(139), "start": Number(117)})}) force_redraw=false
17:04:32 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 99 ==> 117
17:04:32 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 117, end: 139 }
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 99 ==> 117
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 119 ==> 139
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":54}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 54, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":55}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 55, "jsonrpc": "2.0", "result": "n"}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,117,139,[]],"id":56}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 56, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 159, "start": 137}, "languageId": "rust", "buftype": "", "position": {"character": 2, "line": 137}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:32 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(2), "line": Number(137)}), "viewport": Object({"end": Number(159), "start": Number(137)})}) force_redraw=false
17:04:32 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 117 ==> 137
17:04:32 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 137, end: 159 }
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 117 ==> 137
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 139 ==> 159
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":57}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 57, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":58}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 58, "jsonrpc": "2.0", "result": "n"}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,137,159,[]],"id":59}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 59, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 2, "viewport": {"end": 179, "start": 157}, "languageId": "rust", "buftype": "", "position": {"character": 7, "line": 157}, "filename": "/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"}}
17:04:32 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(2), "buftype": String(""), "filename": String("/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs"), "languageId": String("rust"), "position": Object({"character": Number(7), "line": Number(157)}), "viewport": Object({"end": Number(179), "start": Number(157)})}) force_redraw=false
17:04:32 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 137 ==> 157
17:04:32 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs" viewport=Viewport { start: 157, end: 179 }
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.start: 137 ==> 157
17:04:32 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs.end: 159 ==> 179
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs",[]],"id":60}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 60, "jsonrpc": "2.0", "result": 0}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":61}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 61, "jsonrpc": "2.0", "result": "n"}
17:04:32 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[2,3,157,179,[]],"id":62}
17:04:32 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 62, "jsonrpc": "2.0", "result": 0}
17:04:36 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleBufEnter", "jsonrpc": "2.0", "params": {"bufnr": 1, "languageId": "rust", "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:36 INFO unnamed src/language_server_protocol.rs:2739 handle_buf_enter; params=Object({"bufnr": Number(1), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust")})
17:04:36 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"setbufvar","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs","LanguageClient_isServerRunning",1]}
17:04:36 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:36 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:36 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 157 ==> 49
17:04:39 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:39 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:39 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 50
17:04:39 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:39 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:39 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 51
17:04:39 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:39 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:39 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 50
17:04:40 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
17:04:40 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
17:04:40 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 49
20:30:13 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:13 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:13 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
20:30:13 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:13 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:13 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 49
20:30:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 50
20:30:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:16 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:16 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 51
20:30:16 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 29, "line": 52}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:16 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(29), "line": Number(52)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:16 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 52
20:30:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 52 ==> 51
20:30:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 50
20:30:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 49
20:30:18 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:18 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:18 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
20:30:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
20:30:19 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
20:30:19 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 49
22:39:14 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:14 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:14 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 50
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 51}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(51)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 51
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 50}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(50)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 51 ==> 50
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 50 ==> 49
22:39:15 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:15 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:15 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
22:39:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 49}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(49)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 49
22:39:17 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:17 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:17 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 49 ==> 48
22:39:18 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 47}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:18 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(47)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:18 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 47
22:39:18 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 0, "line": 48}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:18 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(0), "line": Number(48)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:18 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 47 ==> 48
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 75, "start": 57}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 57}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:19 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(57)}), "viewport": Object({"end": Number(75), "start": Number(57)})}) force_redraw=false
22:39:19 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 48 ==> 57
22:39:19 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 57, end: 75 }
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.start: 40 ==> 57
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.end: 59 ==> 75
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":63}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 63, "jsonrpc": "2.0", "result": 0}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":64}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 64, "jsonrpc": "2.0", "result": "n"}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,57,75,[]],"id":65}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 65, "jsonrpc": "2.0", "result": 0}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"method": "languageClient/handleCursorMoved", "jsonrpc": "2.0", "params": {"bufnr": 1, "viewport": {"end": 59, "start": 40}, "languageId": "rust", "buftype": "", "position": {"character": 45, "line": 58}, "filename": "/home/dick/LanguageClient-neovim/src/rpcclient.rs"}}
22:39:19 INFO unnamed src/language_server_protocol.rs:2873 handle_cursor_moved; params=Object({"bufnr": Number(1), "buftype": String(""), "filename": String("/home/dick/LanguageClient-neovim/src/rpcclient.rs"), "languageId": String("rust"), "position": Object({"character": Number(45), "line": Number(58)}), "viewport": Object({"end": Number(59), "start": Number(40)})}) force_redraw=false
22:39:19 DEBUG unnamed src/language_client.rs:108 state.last_cursor_line: 57 ==> 58
22:39:19 INFO unnamed src/language_server_protocol.rs:2847 get_signs_to_display; filename="/home/dick/LanguageClient-neovim/src/rpcclient.rs" viewport=Viewport { start: 40, end: 59 }
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.end: 75 ==> 59
22:39:19 DEBUG unnamed src/language_client.rs:108 state.viewports./home/dick/LanguageClient-neovim/src/rpcclient.rs.start: 57 ==> 40
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_signs","params":["/home/dick/LanguageClient-neovim/src/rpcclient.rs",[]],"id":66}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 66, "jsonrpc": "2.0", "result": 0}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:ClearHighlights","params":["__LCN_DIAGNOSTIC_HIGHLIGHT__"]}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"mode","params":[],"id":67}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 67, "jsonrpc": "2.0", "result": "n"}
22:39:19 DEBUG writer-None src/rpcclient.rs:254 => None {"jsonrpc":"2.0","method":"s:set_virtual_texts","params":[1,3,40,59,[]],"id":68}
22:39:19 DEBUG reader-None src/rpcclient.rs:207 <= None {"id": 68, "jsonrpc": "2.0", "result": 0}
16:45:09 INFO reader-None src/rpcclient.rs:241 reader-None terminated

[-- Attachment #3: Type: text/plain, Size: 591 bytes --]


I'm standing by my underwhelming characterization.

C-n'ing through a real-world logfile languageclient.out, which I attach
again here, chops up at around line 44.  This led me to write contrived
tests, which of course are frowned upon in your school of measurement,
whose modus operandi is interminable catechism between a complainant who
laboriously and imprecisely describes slowness, and an inquisitor
auto-replying "doesn't happen here."

To your credit, underwhelming is far better than ineffable, so I've
largely been dismissive of the objections by the usual suspects in
Bug#56393.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 16:30                       ` dick
@ 2022-09-09 16:42                         ` Gregory Heytings
  2022-09-09 17:11                           ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 16:42 UTC (permalink / raw)
  To: dick; +Cc: 57669


>
> C-n'ing through a real-world logfile languageclient.out, which I attach 
> again here, chops up at around line 44.
>

That line has lots of brackets.  Try M-: (setq bidi-inhibit-bpa t) RET.

>
> This led me to write contrived tests, which of course are frowned upon 
> in your school of measurement, whose modus operandi is interminable 
> catechism between a complainant who laboriously and imprecisely 
> describes slowness, and an inquisitor auto-replying "doesn't happen 
> here."
>

What is on master does not claim to make Emacs equally fast in all 
circumstances, which is simply impossible.  Emacs remains responive, but 
yes, it is still (a bit) slow in some cases, and that seems unavoidable 
(without e.g. turning the BPA algorithm off unconditionally, which would 
be unwise).





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 16:42                         ` Gregory Heytings
@ 2022-09-09 17:11                           ` dick
  2022-09-09 18:09                             ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 17:11 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

> That line has lots of brackets.  Try M-: (setq bidi-inhibit-bpa t)
> RET.

I'd rather find-file-literally, which does that and more.  But "No!",
you say, that's throwing the baby out the bathwater.  The baby in
question is usually misshapen demon spawn, i.e, minified json or
logfile.  Much has been made of the so-called full solution, one that
doesn't crimp on syntax highlighting and other niceties.  I think it's a
mistake to complicate the code for max preservation, and more cynically,
I think it's the peanut gallery not wanting to crown a giant slayer.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 16:19                         ` Eli Zaretskii
  2022-09-09 16:25                           ` Gregory Heytings
@ 2022-09-09 17:44                           ` dick
  2022-09-09 18:06                             ` Eli Zaretskii
  1 sibling, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 17:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> and they disable those features _always_, not just lines are long.

Must be nice having the title of "Maintainer."  People just take your
word for things.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 17:44                           ` dick
@ 2022-09-09 18:06                             ` Eli Zaretskii
  2022-09-09 18:22                               ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 18:06 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Fri, 09 Sep 2022 13:44:16 -0400
> 
> > and they disable those features _always_, not just lines are long.
> 
> Must be nice having the title of "Maintainer."  People just take your
> word for things.

They don't have to.  The code is available for studying.

And if you think your code does something different from what I said,
feel free to describe what your code actually does, with enough
details for me and others to understand where I'm wrong.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 17:11                           ` dick
@ 2022-09-09 18:09                             ` Gregory Heytings
  0 siblings, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 18:09 UTC (permalink / raw)
  To: dick; +Cc: 57669

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]


>> That line has lots of brackets.  Try M-: (setq bidi-inhibit-bpa t) RET.
>
> I'd rather find-file-literally, which does that and more.
>

The problem is that find-file-literally does too much.

>
> But "No!", you say, that's throwing the baby out the bathwater.
>

No, IMO the main problem is that doing that is not in any way a graceful 
degradation.

>
> The baby in question is usually misshapen demon spawn, i.e, minified 
> json or logfile.
>

Even in that case, it seems reasonable to believe that seeing "你好" is 
way better than seeing "\344\275\240\345\245\275".

^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 18:06                             ` Eli Zaretskii
@ 2022-09-09 18:22                               ` dick
  2022-09-09 18:57                                 ` Eli Zaretskii
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 18:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> feel free to describe what your code actually does, with enough
> details for me and others to understand where I'm wrong.

I find it asymmetric you can denigrate Commercial Emacs on a public
forum without doing the research or showing a minimal reproducible
example, and that I must go out of my way to fight a presumption of
guilt.

Then again, I'm constantly slamming you for incompetence, so I guess
all's fair in this sad, pathetic war over not money, not fame, but
being right on the internet (cue xkcd cartoon).





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 18:22                               ` dick
@ 2022-09-09 18:57                                 ` Eli Zaretskii
  2022-09-09 19:28                                   ` dick
  2022-09-09 19:55                                   ` dick
  0 siblings, 2 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 18:57 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Fri, 09 Sep 2022 14:22:32 -0400
> 
> > feel free to describe what your code actually does, with enough
> > details for me and others to understand where I'm wrong.
> 
> I find it asymmetric you can denigrate Commercial Emacs on a public
> forum without doing the research or showing a minimal reproducible
> example, and that I must go out of my way to fight a presumption of
> guilt.

I did the research.  As long as you keep waving slogans, instead of
showing your code that deals with very long lines and explaining how
it solves that, I will maintain that my conclusions from studying your
changes are accurate.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 18:57                                 ` Eli Zaretskii
@ 2022-09-09 19:28                                   ` dick
  2022-09-09 19:38                                     ` Eli Zaretskii
  2022-09-09 19:55                                   ` dick
  1 sibling, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 19:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> I did the research.

Good, I believe you.  Given it took me six weeks to make those changes,
I suspect your research took at least a few hours.  So it'd be an
additional hour of your copious time (you're a trust fund kid like me,
right?) to present a minimum reproducible example of Commercial Emacs
being guilty of, and I quote, "disabling those features _always_, not
just when lines are long."

Sheesh, I even made a goshdarn youtube video explaining my approach.

You want proof?  Okay:

src/emacs -Q src/xdisp.c

I trust you'll find no gui features missing between it and GNU Emacs.  I
would further show that my changes do not include ones which, and I
quote, "are plain wrong," but it's much harder to prove the
non-existence of bugs (wouldn't that be nice) than it is for you to
prove their existence.

I was being facetious earlier about being hopping mad.  Now not as much.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 19:28                                   ` dick
@ 2022-09-09 19:38                                     ` Eli Zaretskii
  0 siblings, 0 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-09 19:38 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Fri, 09 Sep 2022 15:28:47 -0400
> 
> You want proof?  Okay:
> 
> src/emacs -Q src/xdisp.c

Sure, showing off display of a pure-ASCII file that uses a single font
proves your case!  (It actually proves mine.)

> I trust you'll find no gui features missing between it and GNU Emacs.  I
> would further show that my changes do not include ones which, and I
> quote, "are plain wrong," but it's much harder to prove the
> non-existence of bugs (wouldn't that be nice) than it is for you to
> prove their existence.

Once again, and for the last time: show your code which deals with
long lines; explain what it does and how.  Then this discussion may
have some value.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 18:57                                 ` Eli Zaretskii
  2022-09-09 19:28                                   ` dick
@ 2022-09-09 19:55                                   ` dick
  2022-09-09 21:28                                     ` Gregory Heytings
  2022-09-10  7:45                                     ` Eli Zaretskii
  1 sibling, 2 replies; 54+ messages in thread
From: dick @ 2022-09-09 19:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> showing your code that deals with very long lines and explaining how
> it solves that

I can't believe I'm dignifying this.  All line references from commit
beb489e.

xdisp.c[9319,9369]: Calculates dy algebraically without char-by-char.
xdisp.c[9537,9577]: Calculates CAPPED to limit char-by-char scan for
moving backwards (Blandy and Moellmann wrote xdisp like a singly linked
list -- fast and precise forwards, much less so going backwards).

A high-level description (which I understand is worthless to you, since
you're all about code not talk) can be found on YouTube.  Cover the
right half of the screen if misshapen faces aggravate a heart condition.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 19:55                                   ` dick
@ 2022-09-09 21:28                                     ` Gregory Heytings
  2022-09-09 22:00                                       ` dick
  2022-09-10  7:45                                     ` Eli Zaretskii
  1 sibling, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 21:28 UTC (permalink / raw)
  To: dick; +Cc: Eli Zaretskii, 57669


>
> xdisp.c[9319,9369]: Calculates dy algebraically without char-by-char.
>
> xdisp.c[9537,9577]: Calculates CAPPED to limit char-by-char scan for 
> moving backwards (Blandy and Moellmann wrote xdisp like a singly linked 
> list -- fast and precise forwards, much less so going backwards).
>

Thanks, finally we get an indication of what your code does and where.

I looked at it briefly, and the first thing I saw does not seem promising. 
Your algebraic calculations are enabled when behaved_p, which depends on 
buffer->text->monospace.  That field is set (unconditionally) to true in 
Fget_buffer_create, and reset only in only one place, in add_properties. 
Can you please elaborate a bit and explain why doing that would be TRT?





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 21:28                                     ` Gregory Heytings
@ 2022-09-09 22:00                                       ` dick
  2022-09-09 22:44                                         ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-09 22:00 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

In add_properties, if I see anything that betrays monospaceness, like an
image or a so-called display-string, I revert to character-by-character
scanning, that is the buffer is no longer "behaved."





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 22:00                                       ` dick
@ 2022-09-09 22:44                                         ` Gregory Heytings
  2022-09-09 23:27                                           ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2022-09-09 22:44 UTC (permalink / raw)
  To: dick; +Cc: 57669


>
> In add_properties, if I see anything that betrays monospaceness, like an 
> image or a so-called display-string, I revert to character-by-character 
> scanning, that is the buffer is no longer "behaved."
>

Yes, I understood that part of your reasoning.  What I'm asking is why you 
believe that doing that is enough.  Aren't there other reasons besides 
properties that "betray monospaceness"?





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 22:44                                         ` Gregory Heytings
@ 2022-09-09 23:27                                           ` dick
  2022-09-10  8:32                                             ` Eli Zaretskii
  2022-09-10 10:26                                             ` Gregory Heytings
  0 siblings, 2 replies; 54+ messages in thread
From: dick @ 2022-09-09 23:27 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 57669

There might be.  I don't have enough user (that's right: I wasn't
presumptuous enough to use the plural) to know.  My immediate response
however is your own,

"I bet that we won't have a single bug report about this."

First you would need to construct a pathological case, like lots of Urdu
and Hindi, then you would need the geometries to be sufficiently extreme
that a user would notice that the page didn't quite scroll up or down
the full page.  Then you'd need me to renege on "perfect is the enemy of
the good."

I would add that unless you're seriously considering replacing narrowing
with my first-principles scheme (doubtful given how many hours you've
invested in narrowing), this is all an academic exercise in
oneupsmanship, which mind you, I am definitely game for.  If that
suggests I believe I dealt with long lines better than you, you'd be
correct.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 19:55                                   ` dick
  2022-09-09 21:28                                     ` Gregory Heytings
@ 2022-09-10  7:45                                     ` Eli Zaretskii
  2022-09-10 12:07                                       ` dick
  2022-09-10 16:55                                       ` Gregory Heytings
  1 sibling, 2 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10  7:45 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Fri, 09 Sep 2022 15:55:07 -0400
> 
> > showing your code that deals with very long lines and explaining how
> > it solves that
> 
> I can't believe I'm dignifying this.  All line references from commit
> beb489e.
> 
> xdisp.c[9319,9369]: Calculates dy algebraically without char-by-char.

This uses state variables from 'struct it' which are _local_ and
_momentary_, i.e. they can change as result of processing any buffer
position, and reflect only the latest change, forgetting what was
before.  Specifically, it->method is such a state variable.  So making
global conclusions, such as that "all characters will have the same
metrics on display", based on it->method is fundamentally wrong, and
can only be true in very simple situations.

The buffer->text->monospace flag is likewise implemented based on
simplistic assumptions: that only text properties could violate the
"monospace-ness" attribute.  Here's why this is simplistic:

  . faces can be applied by overlays as well
  . faces can be applied directly by C code
  . faces can be applied by using glyphs from display-tables
  . even if we only have the default face, fonts used for various
    non-ASCII characters can have different metrics from the default
    face's font, and in some cases they can even be variable-pitch
    fonts
  . portions of display can be made invisible by selective-display,
    not just by 'invisible' properties

(I'm not claiming that the above is the exhaustive list of all the
reasons that the assumptions in behaved_p could be violated; there
could be more of them.)

> xdisp.c[9537,9577]: Calculates CAPPED to limit char-by-char scan for
> moving backwards (Blandy and Moellmann wrote xdisp like a singly linked
> list -- fast and precise forwards, much less so going backwards).

I cannot see how the above description is related to the actual code
in that part of xdisp.c: there's no char-by-char movement back in the
corresponding parts of our code; instead, we move back by lines, then
move forward by characters -- and that's what the code there does as
well.  So I think this part of the code is equivalent to what we do,
in back_to_previous_visible_line_start, and should have the same
performance.  But maybe I'm missing something -- was this change
profiled, and if so, what were the results?  And if this code is
significantly faster, which of its changes is responsible for the
speedups?  And in which kind of files under what major modes were
these speedups measured?

In any case, the replacement code uses behaved_p, whose problematic
assumptions I already explained above.

To comment on the above description: in general, moving the iterator
backwards needs to consider all the changes in the state variables of
'struct it' that eventually affect the metrics and the layout
calculations.  It is _not_ the same as moving back by characters, and
the reason is that the state changes of 'struct it' are defined (in
set_iterator_to_next, get_next_display_element, and their subroutines)
only for moving forward, not for moving back.  That is why all
move_it_* functions cannot move back, except by going to a preceding
newline and then coming forward.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 23:27                                           ` dick
@ 2022-09-10  8:32                                             ` Eli Zaretskii
  2022-09-10 12:51                                               ` dick
  2022-09-10 10:26                                             ` Gregory Heytings
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10  8:32 UTC (permalink / raw)
  To: dick; +Cc: gregory, 57669

> Cc: 57669@debbugs.gnu.org
> From: dick <dick.r.chiang@gmail.com>
> Date: Fri, 09 Sep 2022 19:27:13 -0400
> 
> First you would need to construct a pathological case, like lots of Urdu
> and Hindi

There's nothing pathological about Hindi text.  In fact, the JSON and
XML files with very long lines, which we are using for this work,
quite frequently have non-ASCII text from various scripts, including
R2L scripts.  At least one of them I think went as far as showing
strings in every supported script.

> I would add that unless you're seriously considering replacing narrowing
> with my first-principles scheme (doubtful given how many hours you've
> invested in narrowing), this is all an academic exercise in
> oneupsmanship, which mind you, I am definitely game for.  If that
> suggests I believe I dealt with long lines better than you, you'd be
> correct.

This is not a pissing contest, at least not on our part.  We are
keenly interested in using any ideas that are correct, can be
implemented without too many complications, and provide significant
speedups, especially for very long lines.

For example, if the behaved_p idea, when implemented correctly
(i.e. when it takes into considerations _all_ the factors that violate
the monospace-ness assumption), can significantly speed up redisplay
in some situations, we would like to use it, at least when the
long_line_optimizations_p flag is set, if not always.  However, both
the correct conditions for behaved_p and the actual speedups still
need to be coded and measured, before we can make that decision.

One fundamental problem with the behaved_p idea is that the conditions
it should test, when implemented correctly, can change at any buffer
position, and at least for some of them (e.g., when a character is
displayed by glyphs from a display-table), we don't have any way of
knowing that in advance, except by examining every character, which
basically annuls any advantages of this idea.  So I'm not sure if this
idea is usable in a way that doesn't introduce subtle bugs.  But maybe
such bugs could be tolerable when lines are very long (which means the
relevant optimizations should only be taken when the
long_line_optimizations_p flag is set)?





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-09 23:27                                           ` dick
  2022-09-10  8:32                                             ` Eli Zaretskii
@ 2022-09-10 10:26                                             ` Gregory Heytings
  1 sibling, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2022-09-10 10:26 UTC (permalink / raw)
  To: dick; +Cc: 57669


>
> I would add that unless you're seriously considering replacing narrowing 
> with my first-principles scheme (doubtful given how many hours you've 
> invested in narrowing), this is all an academic exercise in 
> oneupsmanship, which mind you, I am definitely game for.
>

My sole aim here is to improve Emacs, which is why I'm interested in all 
good ideas.  If it turned out that your scheme gives better results in 
some cases, I don't see why it couldn't be included in Emacs.  And if (but 
that seems less likely) it turned out that your scheme gives better 
results in all cases, I don't see why it wouldn't replace what is on 
master.

>
> If that suggests I believe I dealt with long lines better than you, 
> you'd be correct.
>

From what I see, you are a competent programmer.  I find it regrettable 
that you turn this (and other discussions) into an ego quarrel.  As I 
already said, your contributions and ideas are welcome.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10  7:45                                     ` Eli Zaretskii
@ 2022-09-10 12:07                                       ` dick
  2022-09-10 12:20                                         ` dick
  2022-09-10 12:24                                         ` Eli Zaretskii
  2022-09-10 16:55                                       ` Gregory Heytings
  1 sibling, 2 replies; 54+ messages in thread
From: dick @ 2022-09-10 12:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

EZ> So I think this part of the code is equivalent to what we do, in
EZ> back_to_previous_visible_line_start

I'm glad you noticed!  It means you're actually reading the code!

One difference is I gate line scanning (as opposed to character
scanning) with behaved_p, whereas GNU crosses its fingers and hopes its
POS_LIMIT estimate is far enough.  So oddly enough, for all my cavailier
assumptions, at least this part of the code [xdisp.c 9537:9577] is
*more* conservative than GNU.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 12:07                                       ` dick
@ 2022-09-10 12:20                                         ` dick
  2022-09-10 12:24                                         ` Eli Zaretskii
  1 sibling, 0 replies; 54+ messages in thread
From: dick @ 2022-09-10 12:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> [xdisp.c 9537:9577] is *more* conservative than GNU.

Ah, I'm wrong about this.  My bad.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 12:07                                       ` dick
  2022-09-10 12:20                                         ` dick
@ 2022-09-10 12:24                                         ` Eli Zaretskii
  1 sibling, 0 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10 12:24 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Sat, 10 Sep 2022 08:07:24 -0400
> 
> EZ> So I think this part of the code is equivalent to what we do, in
> EZ> back_to_previous_visible_line_start
> 
> I'm glad you noticed!  It means you're actually reading the code!

You cannot say anything of an essence without ad-hominem, can you?

> One difference is I gate line scanning (as opposed to character
> scanning) with behaved_p, whereas GNU crosses its fingers and hopes its
> POS_LIMIT estimate is far enough.  So oddly enough, for all my cavailier
> assumptions, at least this part of the code [xdisp.c 9537:9577] is
> *more* conservative than GNU.

But since behaved_p is actually inaccurate at best, that doesn't
really matter, does it?  It just trades one class of cases where the
shortcut doesn't work for another.  You simply haven't yet met the
situations where those problems happen, most probably because you
tested only simple cases, like all-ASCII files which use a single
fixed-pitch font.  The code on master went through much more testing,
by more users, during several years.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10  8:32                                             ` Eli Zaretskii
@ 2022-09-10 12:51                                               ` dick
  2022-09-10 13:09                                                 ` Eli Zaretskii
  2022-09-10 13:22                                                 ` Eli Zaretskii
  0 siblings, 2 replies; 54+ messages in thread
From: dick @ 2022-09-10 12:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

monospace-p I agree is an heuristic like narrowing.  In the majority of
cases of long lines, it applies the algebraic shortcut when it thinks it
can get away with it.

What if it's wrong?  Then it won't scroll up or down the full page.
What if it scrolls zero on a C-n?  That'd be a degenerate case, one
which I'd have a hard time contriving, but that would only make it as
culpable as 29.0.50 which we already know can scroll zero on C-n.

But until Commercial can gather a following, my sanguinity is all
pissing-contest speculation.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 12:51                                               ` dick
@ 2022-09-10 13:09                                                 ` Eli Zaretskii
  2022-09-10 13:29                                                   ` Eli Zaretskii
  2022-09-10 13:22                                                 ` Eli Zaretskii
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10 13:09 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Sat, 10 Sep 2022 08:51:50 -0400
> 
> monospace-p I agree is an heuristic like narrowing.  In the majority of
> cases of long lines, it applies the algebraic shortcut when it thinks it
> can get away with it.

My guess is that it disables the shortcut in any buffer that has
font-lock turned on.  Turning off font-lock is known to speed up
things significantly, even without the shortcut, but we thought that
turning it off would be asking too much.  Thus, a satisfactory
solution must work in the presence of faces and in the presence of
different fonts, because the real-life use cases where we see very
long lines use both.

So I think we can only apply such shortcuts when lines are very long,
in which case the resulting inaccuracies in layout calculations could
be perhaps tolerated.  I don't think it's feasible to apply them
always, because once we make behaved_p accurate enough (if that is at
all feasible), it will probably lose its attractiveness.

The other question is: if we apply these shortcuts when lines are very
long, what do we gain?  If performance becomes significantly better,
it would perhaps mean we can enlarge long-line-threshold's value, or
make the default narrowing region larger.  But I don't think we can
avoid the narrowing completely, because anything else will still scale
at least linearly with the line length, and so will at some point
become unbearably slow.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 12:51                                               ` dick
  2022-09-10 13:09                                                 ` Eli Zaretskii
@ 2022-09-10 13:22                                                 ` Eli Zaretskii
  2022-09-10 14:03                                                   ` dick
  1 sibling, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10 13:22 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Sat, 10 Sep 2022 08:51:50 -0400
> 
> monospace-p I agree is an heuristic like narrowing.  In the majority of
> cases of long lines, it applies the algebraic shortcut when it thinks it
> can get away with it.

Btw, the way you reset the monospace flag in add_text_properties is
also problematic: the code is looking only at the specific face that
is the value of the property.  But Emacs applies faces by merging them
with other sources of face information, not just by using the single
face named by the property.  As the simplest example, consider a face
whose only non-unspecified attribute is :inherit -- in that case,
AFAIU your code will not reset the monospace flag, but when Emacs will
actually use the face for rendering, it will follow the inheritance
chain and might find there one of the face attributes your code does
care about.

Also, I don't see the monospace flag being reset if the face's font is
not a fixed-pitch one.  Did I miss something?





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 13:09                                                 ` Eli Zaretskii
@ 2022-09-10 13:29                                                   ` Eli Zaretskii
  0 siblings, 0 replies; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10 13:29 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 57669

> Cc: 57669@debbugs.gnu.org
> Date: Sat, 10 Sep 2022 16:09:04 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: dick <dick.r.chiang@gmail.com>
> > Cc: 57669@debbugs.gnu.org
> > Date: Sat, 10 Sep 2022 08:51:50 -0400
> > 
> > monospace-p I agree is an heuristic like narrowing.  In the majority of
> > cases of long lines, it applies the algebraic shortcut when it thinks it
> > can get away with it.
> 
> My guess is that it disables the shortcut in any buffer that has
> font-lock turned on.

I thought one thing, but wrote something that implies another.  What I
meant was "any buffer that has font-lock turned on and uses
non-default fonts for the font-lock faces" -- the last part was
missing.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 13:22                                                 ` Eli Zaretskii
@ 2022-09-10 14:03                                                   ` dick
  2022-09-10 14:20                                                     ` Eli Zaretskii
  0 siblings, 1 reply; 54+ messages in thread
From: dick @ 2022-09-10 14:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

You've identified the weakest point and you continue to squeeze.
Fortunately my weakest point is monospace_p, an heuristic, one which
I feel makes the right compromises.

I wouldn't be surprised if "heuristic" didn't surface in your self-study
of programming.  The narrowing in 29.0.50 is also an "heuristic."

> As the simplest example, consider a face whose only non-unspecified

Like you, I largely dismiss prose but will begrudgingly run a minimum
reproducible example.  If it's so simple, please follow your own
bug-reporting advice:

  Please describe exactly what actions triggered the bug...
  If you can, give a recipe starting from 'emacs -Q'

You'll find that I *always* do this in epic arguments of this scale.
You, I noticed, traffic in hand-wavy refrains like "I've been doing this
for years," "If you read the code, you'd know why," "He simply doesn't
understand the code."






^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 14:03                                                   ` dick
@ 2022-09-10 14:20                                                     ` Eli Zaretskii
  2022-09-10 14:52                                                       ` dick
  0 siblings, 1 reply; 54+ messages in thread
From: Eli Zaretskii @ 2022-09-10 14:20 UTC (permalink / raw)
  To: dick; +Cc: 57669

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57669@debbugs.gnu.org
> Date: Sat, 10 Sep 2022 10:03:55 -0400
> 
> Like you, I largely dismiss prose but will begrudgingly run a minimum
> reproducible example.  If it's so simple, please follow your own
> bug-reporting advice:
> 
>   Please describe exactly what actions triggered the bug...
>   If you can, give a recipe starting from 'emacs -Q'

I'm not interested in reporting bugs for a fork of Emacs.  I _am_
interested in discussing ideas for making display of long lines in
Emacs better, so if you are interested as well, you will respond in
kind.  Otherwise, I guess this discussion has exhausted itself, at
least as far as your participation is concerned.

Fortunately, you are not the only participant, and others might be
interested in what I have to say.

> You'll find that I *always* do this in epic arguments of this scale.
> You, I noticed, traffic in hand-wavy refrains like "I've been doing this
> for years," "If you read the code, you'd know why," "He simply doesn't
> understand the code."

This kind of ad hominem usually means you've run out of real
arguments.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10 14:20                                                     ` Eli Zaretskii
@ 2022-09-10 14:52                                                       ` dick
  0 siblings, 0 replies; 54+ messages in thread
From: dick @ 2022-09-10 14:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669

> This kind of ad hominem usually means you've run out of real
> arguments.

Took the words right out of my mouth:

  Bug#57212
  If you'd read the code guarded by that flag and understand what it
  does, you wouldn't have made such nonsensical proposals.

  Bug#57669
  And that is _after_ you factor out changes that are plain wrong,
  because he simply didn't understand what the code does well enough.





^ permalink raw reply	[flat|nested] 54+ messages in thread

* bug#57669: 29.0.50; C-n, C-p off under long lines
  2022-09-10  7:45                                     ` Eli Zaretskii
  2022-09-10 12:07                                       ` dick
@ 2022-09-10 16:55                                       ` Gregory Heytings
  1 sibling, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2022-09-10 16:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57669, dick


>
> The buffer->text->monospace flag is likewise implemented based on 
> simplistic assumptions: that only text properties could violate the 
> "monospace-ness" attribute.  Here's why this is simplistic:
>
> . faces can be applied by overlays as well
>
> . faces can be applied directly by C code
>
> . faces can be applied by using glyphs from display-tables
>
> . even if we only have the default face, fonts used for various 
> non-ASCII characters can have different metrics from the default face's 
> font, and in some cases they can even be variable-pitch fonts
>
> . portions of display can be made invisible by selective-display, not 
> just by 'invisible' properties
>
> (I'm not claiming that the above is the exhaustive list of all the 
> reasons that the assumptions in behaved_p could be violated; there could 
> be more of them.)
>

FWIW, the simplest recipe for the fourth point above is to create a buffer 
with a long line (with say C-u 10000 a) and to insert, somewhere in the 
middle of that line, characters which have a width equal to zero (e.g. C-x 
8 RET zero width space RET) and characters which have a width equal to two 
(e.g. C-x 8 RET e i s s a).  You'll see that your algebraic calculations 
do not work anymore.





^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2022-09-10 16:55 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-08  5:40 bug#57669: 29.0.50; C-n, C-p off under long lines dick.r.chiang
2022-09-08  7:38 ` Gregory Heytings
2022-09-08  8:17 ` Eli Zaretskii
2022-09-08 12:02   ` dick
2022-09-08 17:12     ` Gregory Heytings
2022-09-08 18:13       ` dick
2022-09-08 18:26         ` Gregory Heytings
2022-09-09  6:00         ` Eli Zaretskii
2022-09-09 13:08           ` dick
2022-09-09 13:38             ` Gregory Heytings
2022-09-09 14:34               ` dick
2022-09-09 14:39                 ` Gregory Heytings
2022-09-09 15:06                   ` dick
2022-09-09 15:41                     ` Gregory Heytings
2022-09-09 16:30                       ` dick
2022-09-09 16:42                         ` Gregory Heytings
2022-09-09 17:11                           ` dick
2022-09-09 18:09                             ` Gregory Heytings
2022-09-09 15:49                 ` Eli Zaretskii
2022-09-09 15:58                   ` Gregory Heytings
2022-09-09 16:04                     ` Eli Zaretskii
2022-09-09 14:12             ` Eli Zaretskii
2022-09-09 15:04               ` dick
2022-09-09 15:19                 ` Gregory Heytings
2022-09-09 15:52                   ` dick
2022-09-09 16:03                     ` Eli Zaretskii
2022-09-09 16:06                       ` Gregory Heytings
2022-09-09 16:19                         ` Eli Zaretskii
2022-09-09 16:25                           ` Gregory Heytings
2022-09-09 17:44                           ` dick
2022-09-09 18:06                             ` Eli Zaretskii
2022-09-09 18:22                               ` dick
2022-09-09 18:57                                 ` Eli Zaretskii
2022-09-09 19:28                                   ` dick
2022-09-09 19:38                                     ` Eli Zaretskii
2022-09-09 19:55                                   ` dick
2022-09-09 21:28                                     ` Gregory Heytings
2022-09-09 22:00                                       ` dick
2022-09-09 22:44                                         ` Gregory Heytings
2022-09-09 23:27                                           ` dick
2022-09-10  8:32                                             ` Eli Zaretskii
2022-09-10 12:51                                               ` dick
2022-09-10 13:09                                                 ` Eli Zaretskii
2022-09-10 13:29                                                   ` Eli Zaretskii
2022-09-10 13:22                                                 ` Eli Zaretskii
2022-09-10 14:03                                                   ` dick
2022-09-10 14:20                                                     ` Eli Zaretskii
2022-09-10 14:52                                                       ` dick
2022-09-10 10:26                                             ` Gregory Heytings
2022-09-10  7:45                                     ` Eli Zaretskii
2022-09-10 12:07                                       ` dick
2022-09-10 12:20                                         ` dick
2022-09-10 12:24                                         ` Eli Zaretskii
2022-09-10 16:55                                       ` Gregory Heytings

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.