Open GreenYun opened 1 week ago
Try this code:
use std::env; fn main() { let mut var1 = String::new(); let mut var2 = String::new(); env::vars_os() .map(|(k, v)| { ( k.to_string_lossy().into_owned().to_uppercase(), v.to_string_lossy().into_owned(), ) }) .for_each(|(key, val)| match key.as_str() { "VAR1" => var1 = val, "VAR2" => var2 = val, _ => (), }); println!("{var1}, {var2}"); }
Also, configure Zed and rust-analyzer to show inlay hints:
{ "inlay_hints": { "enabled": true }, "lsp": { "rust-analyzer": { "initialization_options": { "inlayHints": { "expressionAdjustmentHints": { "enable": "reborrow" }, "typeHints": { "hideNamedConstructor": true } } }} } }
This is what Zed shows (Please focus on line 10, missing an opening parenthesis for the closing one):
If I slightly edit line 10, e.g. add an dot before .to_uppercase(), then delete it, Zed shows:
.to_uppercase()
Different changes to line 10 then rolling back will produce different the inlay hints. This is fun.
Zed: v0.140.5 (Zed) OS: macOS 12.7.5 Memory: 8 GiB Architecture: x86_64
For reference, VS Code with rust-analyzer gives stable, correct output of inlay hints:
~/Library/Logs/Zed/Zed.log
This seems very similar to https://github.com/zed-industries/zed/issues/7928 , at least the underlying ordering issue is shared.
Check for existing issues
Describe the bug / provide steps to reproduce it
Try this code:
Also, configure Zed and rust-analyzer to show inlay hints:
This is what Zed shows (Please focus on line 10, missing an opening parenthesis for the closing one):
If I slightly edit line 10, e.g. add an dot before
.to_uppercase()
, then delete it, Zed shows:Different changes to line 10 then rolling back will produce different the inlay hints. This is fun.
Environment
Zed: v0.140.5 (Zed) OS: macOS 12.7.5 Memory: 8 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
For reference, VS Code with rust-analyzer gives stable, correct output of inlay hints:
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.Zed.log