mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
Assign mutable semantic token modifier to assignment operators
This commit is contained in:
parent
b3337c26db
commit
d1256a3709
@ -55,7 +55,6 @@ pub(super) fn element(
|
||||
name_ref,
|
||||
)
|
||||
}
|
||||
|
||||
// Simple token-based highlighting
|
||||
COMMENT => {
|
||||
let comment = element.into_token().and_then(ast::Comment::cast)?;
|
||||
@ -132,16 +131,18 @@ pub(super) fn element(
|
||||
.into()
|
||||
}
|
||||
_ if parent_matches::<ast::PrefixExpr>(&element) => HlOperator::Other.into(),
|
||||
T![+] | T![-] | T![*] | T![/] | T![+=] | T![-=] | T![*=] | T![/=]
|
||||
if parent_matches::<ast::BinExpr>(&element) =>
|
||||
{
|
||||
T![+] | T![-] | T![*] | T![/] if parent_matches::<ast::BinExpr>(&element) => {
|
||||
HlOperator::Arithmetic.into()
|
||||
}
|
||||
T![|] | T![&] | T![!] | T![^] | T![|=] | T![&=] | T![^=]
|
||||
if parent_matches::<ast::BinExpr>(&element) =>
|
||||
{
|
||||
T![+=] | T![-=] | T![*=] | T![/=] if parent_matches::<ast::BinExpr>(&element) => {
|
||||
Highlight::from(HlOperator::Arithmetic) | HlMod::Mutable
|
||||
}
|
||||
T![|] | T![&] | T![!] | T![^] if parent_matches::<ast::BinExpr>(&element) => {
|
||||
HlOperator::Bitwise.into()
|
||||
}
|
||||
T![|=] | T![&=] | T![^=] if parent_matches::<ast::BinExpr>(&element) => {
|
||||
Highlight::from(HlOperator::Bitwise) | HlMod::Mutable
|
||||
}
|
||||
T![&&] | T![||] if parent_matches::<ast::BinExpr>(&element) => {
|
||||
HlOperator::Logical.into()
|
||||
}
|
||||
|
@ -195,6 +195,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||
<span class="macro">noop!</span><span class="parenthesis">(</span><span class="macro">noop</span><span class="macro">!</span><span class="parenthesis">(</span><span class="numeric_literal">1</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||
|
||||
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> <span class="operator">=</span> <span class="numeric_literal">42</span><span class="semicolon">;</span>
|
||||
<span class="variable mutable">x</span> <span class="arithmetic mutable">+=</span> <span class="numeric_literal">1</span><span class="semicolon">;</span>
|
||||
<span class="keyword">let</span> <span class="variable declaration mutable">y</span> <span class="operator">=</span> <span class="operator">&</span><span class="keyword">mut</span> <span class="variable mutable">x</span><span class="semicolon">;</span>
|
||||
<span class="keyword">let</span> <span class="variable declaration">z</span> <span class="operator">=</span> <span class="operator">&</span><span class="variable mutable">y</span><span class="semicolon">;</span>
|
||||
|
||||
|
@ -168,6 +168,7 @@ fn main() {
|
||||
noop!(noop!(1));
|
||||
|
||||
let mut x = 42;
|
||||
x += 1;
|
||||
let y = &mut x;
|
||||
let z = &y;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user