From 10e7fd25feb96f7fe5b82864374833ebf273fa2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 10 Jan 2021 17:56:53 +0200 Subject: [PATCH] Fix typo, parentheses is plural --- crates/ide/src/syntax_highlighting/tags.rs | 2 +- .../test_data/highlight_assoc_functions.html | 14 +-- .../test_data/highlight_doctest.html | 18 ++-- .../test_data/highlight_injection.html | 12 +-- .../test_data/highlight_strings.html | 96 +++++++++---------- .../test_data/highlight_unsafe.html | 22 ++--- .../test_data/highlighting.html | 78 +++++++-------- .../test_data/injection.html | 14 +-- .../test_data/rainbow_highlighting.html | 10 +- crates/syntax/src/validation.rs | 4 +- 10 files changed, 135 insertions(+), 135 deletions(-) diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index a4396e79036..8dd05ac5245 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs @@ -120,7 +120,7 @@ impl HlTag { HlTag::Punctuation(punct) => match punct { HlPunct::Bracket => "bracket", HlPunct::Brace => "brace", - HlPunct::Parenthesis => "parentheses", + HlPunct::Parenthesis => "parenthesis", HlPunct::Angle => "angle", HlPunct::Comma => "comma", HlPunct::Dot => "dot", diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html index d4e7b45befd..e36e6fc3fa1 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html @@ -36,22 +36,22 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
fn not_static() {}
+
fn not_static() {}
 
 struct foo {}
 
 impl foo {
-    pub fn is_static() {}
-    pub fn is_not_static(&self) {}
+    pub fn is_static() {}
+    pub fn is_not_static(&self) {}
 }
 
 trait t {
-    fn t_is_static() {}
-    fn t_is_not_static(&self) {}
+    fn t_is_static() {}
+    fn t_is_not_static(&self) {}
 }
 
 impl t for foo {
-    pub fn is_static() {}
-    pub fn is_not_static(&self) {}
+    pub fn is_static() {}
+    pub fn is_not_static(&self) {}
 }
         
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index df0cf3704a6..6dadda1c1dd 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html @@ -56,10 +56,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// # Examples /// /// ``` - /// # #![allow(unused_mut)] - /// let mut foo: Foo = Foo::new(); + /// # #![allow(unused_mut)] + /// let mut foo: Foo = Foo::new(); /// ``` - pub const fn new() -> Foo { + pub const fn new() -> Foo { Foo { bar: true } } @@ -70,10 +70,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// ``` /// use x::y; /// - /// let foo = Foo::new(); + /// let foo = Foo::new(); /// /// // calls bar on foo - /// assert!(foo.bar()); + /// assert!(foo.bar()); /// /// let bar = foo.bar || Foo::bar; /// @@ -87,22 +87,22 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// ``` /// /// ```rust,no_run - /// let foobar = Foo::new().bar(); + /// let foobar = Foo::new().bar(); /// ``` /// /// ```sh /// echo 1 /// ``` - pub fn foo(&self) -> bool { + pub fn foo(&self) -> bool { true } } /// ``` -/// noop!(1); +/// noop!(1); /// ``` macro_rules! noop { - ($expr:expr) => { + ($expr:expr) => { $expr } }
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html b/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html index 169c268f593..753b535b553 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html @@ -36,14 +36,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
fn fixture(ra_fixture: &str) {}
+
fn fixture(ra_fixture: &str) {}
 
-fn main() {
-    fixture(r#"
+fn main() {
+    fixture(r#"
         trait Foo {
-            fn foo() {
-                println!("2 + 2 = {}", 4);
+            fn foo() {
+                println!("2 + 2 = {}", 4);
             }
         }"#
-    );
+    );
 }
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html index d8626c8bc28..66d80c4b66c 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html @@ -37,63 +37,63 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
macro_rules! println {
-    ($($arg:tt)*) => ({
-        $crate::io::_print($crate::format_args_nl!($($arg)*));
-    })
+    ($($arg:tt)*) => ({
+        $crate::io::_print($crate::format_args_nl!($($arg)*));
+    })
 }
 #[rustc_builtin_macro]
 macro_rules! format_args_nl {
-    ($fmt:expr) => {{ /* compiler built-in */ }};
-    ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
+    ($fmt:expr) => {{ /* compiler built-in */ }};
+    ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
 }
 
-fn main() {
+fn main() {
     // from https://doc.rust-lang.org/std/fmt/index.html
-    println!("Hello");                 // => "Hello"
-    println!("Hello, {}!", "world");   // => "Hello, world!"
-    println!("The number is {}", 1);   // => "The number is 1"
-    println!("{:?}", (3, 4));          // => "(3, 4)"
-    println!("{value}", value=4);      // => "4"
-    println!("{} {}", 1, 2);           // => "1 2"
-    println!("{:04}", 42);             // => "0042" with leading zerosV
-    println!("{1} {} {0} {}", 1, 2);   // => "2 1 1 2"
-    println!("{argument}", argument = "test");   // => "test"
-    println!("{name} {}", 1, name = 2);          // => "2 1"
-    println!("{a} {c} {b}", a="a", b='b', c=3);  // => "a 3 b"
-    println!("{{{}}}", 2);                       // => "{2}"
-    println!("Hello {:5}!", "x");
-    println!("Hello {:1$}!", "x", 5);
-    println!("Hello {1:0$}!", 5, "x");
-    println!("Hello {:width$}!", "x", width = 5);
-    println!("Hello {:<5}!", "x");
-    println!("Hello {:-<5}!", "x");
-    println!("Hello {:^5}!", "x");
-    println!("Hello {:>5}!", "x");
-    println!("Hello {:+}!", 5);
-    println!("{:#x}!", 27);
-    println!("Hello {:05}!", 5);
-    println!("Hello {:05}!", -5);
-    println!("{:#010x}!", 27);
-    println!("Hello {0} is {1:.5}", "x", 0.01);
-    println!("Hello {1} is {2:.0$}", 5, "x", 0.01);
-    println!("Hello {0} is {2:.1$}", "x", 5, 0.01);
-    println!("Hello {} is {:.*}",    "x", 5, 0.01);
-    println!("Hello {} is {2:.*}",   "x", 5, 0.01);
-    println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
-    println!("{}, `{name:.*}` has 3 fractional digits", "Hello", 3, name=1234.56);
-    println!("{}, `{name:.*}` has 3 characters", "Hello", 3, name="1234.56");
-    println!("{}, `{name:>8.*}` has 3 right-aligned characters", "Hello", 3, name="1234.56");
-    println!("Hello {{}}");
-    println!("{{ Hello");
+    println!("Hello");                 // => "Hello"
+    println!("Hello, {}!", "world");   // => "Hello, world!"
+    println!("The number is {}", 1);   // => "The number is 1"
+    println!("{:?}", (3, 4));          // => "(3, 4)"
+    println!("{value}", value=4);      // => "4"
+    println!("{} {}", 1, 2);           // => "1 2"
+    println!("{:04}", 42);             // => "0042" with leading zerosV
+    println!("{1} {} {0} {}", 1, 2);   // => "2 1 1 2"
+    println!("{argument}", argument = "test");   // => "test"
+    println!("{name} {}", 1, name = 2);          // => "2 1"
+    println!("{a} {c} {b}", a="a", b='b', c=3);  // => "a 3 b"
+    println!("{{{}}}", 2);                       // => "{2}"
+    println!("Hello {:5}!", "x");
+    println!("Hello {:1$}!", "x", 5);
+    println!("Hello {1:0$}!", 5, "x");
+    println!("Hello {:width$}!", "x", width = 5);
+    println!("Hello {:<5}!", "x");
+    println!("Hello {:-<5}!", "x");
+    println!("Hello {:^5}!", "x");
+    println!("Hello {:>5}!", "x");
+    println!("Hello {:+}!", 5);
+    println!("{:#x}!", 27);
+    println!("Hello {:05}!", 5);
+    println!("Hello {:05}!", -5);
+    println!("{:#010x}!", 27);
+    println!("Hello {0} is {1:.5}", "x", 0.01);
+    println!("Hello {1} is {2:.0$}", 5, "x", 0.01);
+    println!("Hello {0} is {2:.1$}", "x", 5, 0.01);
+    println!("Hello {} is {:.*}",    "x", 5, 0.01);
+    println!("Hello {} is {2:.*}",   "x", 5, 0.01);
+    println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
+    println!("{}, `{name:.*}` has 3 fractional digits", "Hello", 3, name=1234.56);
+    println!("{}, `{name:.*}` has 3 characters", "Hello", 3, name="1234.56");
+    println!("{}, `{name:>8.*}` has 3 right-aligned characters", "Hello", 3, name="1234.56");
+    println!("Hello {{}}");
+    println!("{{ Hello");
 
-    println!(r"Hello, {}!", "world");
+    println!(r"Hello, {}!", "world");
 
     // escape sequences
-    println!("Hello\nWorld");
-    println!("\u{48}\x65\x6C\x6C\x6F World");
+    println!("Hello\nWorld");
+    println!("\u{48}\x65\x6C\x6C\x6F World");
 
-    println!("{\x41}", A = 92);
-    println!("{ничоси}", ничоси = 92);
+    println!("{\x41}", A = 92);
+    println!("{ничоси}", ничоси = 92);
 
-    println!("{:x?} {} ", thingy, n2);
+    println!("{:x?} {} ", thingy, n2);
 }
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html index 56a4380fbf9..9d4d6d4a081 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html @@ -36,7 +36,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
unsafe fn unsafe_fn() {}
+
unsafe fn unsafe_fn() {}
 
 union Union {
     a: u32,
@@ -46,7 +46,7 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 struct HasUnsafeFn;
 
 impl HasUnsafeFn {
-    unsafe fn unsafe_method(&self) {}
+    unsafe fn unsafe_method(&self) {}
 }
 
 struct TypeForStaticMut {
@@ -55,31 +55,31 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 
 static mut global_mut: TypeForStaticMut = TypeForStaticMut { a: 0 };
 
-#[repr(packed)]
+#[repr(packed)]
 struct Packed {
     a: u16,
 }
 
 trait DoTheAutoref {
-    fn calls_autoref(&self);
+    fn calls_autoref(&self);
 }
 
 impl DoTheAutoref for u16 {
-    fn calls_autoref(&self) {}
+    fn calls_autoref(&self) {}
 }
 
-fn main() {
+fn main() {
     let x = &5 as *const _ as *const usize;
     let u = Union { b: 0 };
     unsafe {
         // unsafe fn and method calls
-        unsafe_fn();
+        unsafe_fn();
         let b = u.b;
         match u {
-            Union { b: 0 } => (),
-            Union { a } => (),
+            Union { b: 0 } => (),
+            Union { a } => (),
         }
-        HasUnsafeFn.unsafe_method();
+        HasUnsafeFn.unsafe_method();
 
         // unsafe deref
         let y = *x;
@@ -95,6 +95,6 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
         let Packed { a: ref _a } = packed;
 
         // unsafe auto ref of packed field
-        packed.a.calls_autoref();
+        packed.a.calls_autoref();
     }
 }
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index b7bec083b74..6b7447c46e1 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -66,104 +66,104 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } trait Bar { - fn bar(&self) -> i32; + fn bar(&self) -> i32; } impl Bar for Foo { - fn bar(&self) -> i32 { + fn bar(&self) -> i32 { self.x } } impl Foo { - fn baz(mut self, f: Foo) -> i32 { - f.baz(self) + fn baz(mut self, f: Foo) -> i32 { + f.baz(self) } - fn qux(&mut self) { + fn qux(&mut self) { self.x = 0; } - fn quop(&self) -> i32 { + fn quop(&self) -> i32 { self.x } } -#[derive(Copy)] +#[derive(Copy)] struct FooCopy { x: u32, } impl FooCopy { - fn baz(self, f: FooCopy) -> u32 { - f.baz(self) + fn baz(self, f: FooCopy) -> u32 { + f.baz(self) } - fn qux(&mut self) { + fn qux(&mut self) { self.x = 0; } - fn quop(&self) -> u32 { + fn quop(&self) -> u32 { self.x } } static mut STATIC_MUT: i32 = 0; -fn foo<'a, T>() -> T { - foo::<'a, i32>() +fn foo<'a, T>() -> T { + foo::<'a, i32>() } -fn never() -> ! { +fn never() -> ! { loop {} } -fn const_param<const FOO: usize>() -> usize { +fn const_param<const FOO: usize>() -> usize { FOO } use ops::Fn; -fn baz<F: Fn() -> ()>(f: F) { - f() +fn baz<F: Fn() -> ()>(f: F) { + f() } -fn foobar() -> impl Copy {} +fn foobar() -> impl Copy {} -fn foo() { - let bar = foobar(); +fn foo() { + let bar = foobar(); } macro_rules! def_fn { - ($($tt:tt)*) => {$($tt)*} + ($($tt:tt)*) => {$($tt)*} } def_fn! { - fn bar() -> u32 { + fn bar() -> u32 { 100 } } macro_rules! noop { - ($expr:expr) => { + ($expr:expr) => { $expr } } macro_rules! keyword_frag { - ($type:ty) => ($type) + ($type:ty) => ($type) } // comment -fn main() { - println!("Hello, {}!", 92); +fn main() { + println!("Hello, {}!", 92); - let mut vec = Vec::new(); + let mut vec = Vec::new(); if true { let x = 92; - vec.push(Foo { x, y: 1 }); + vec.push(Foo { x, y: 1 }); } unsafe { - vec.set_len(0); + vec.set_len(0); STATIC_MUT = 1; } @@ -171,7 +171,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd // Do nothing } - noop!(noop!(1)); + noop!(noop!(1)); let mut x = 42; let y = &mut x; @@ -183,14 +183,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd let mut foo = Foo { x, y: x }; let foo2 = Foo { x, y: x }; - foo.quop(); - foo.qux(); - foo.baz(foo2); + foo.quop(); + foo.qux(); + foo.baz(foo2); let mut copy = FooCopy { x }; - copy.quop(); - copy.qux(); - copy.baz(copy); + copy.quop(); + copy.qux(); + copy.baz(copy); let a = |x| x; let bar = Foo::baz; @@ -207,15 +207,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } enum Option<T> { - Some(T), + Some(T), None, } use Option::*; impl<T> Option<T> { - fn and<U>(self, other: Option<U>) -> Option<(T, U)> { + fn and<U>(self, other: Option<U>) -> Option<(T, U)> { match other { - None => unimplemented!(), + None => unimplemented!(), Nope => Nope, } } diff --git a/crates/ide/src/syntax_highlighting/test_data/injection.html b/crates/ide/src/syntax_highlighting/test_data/injection.html index 52fabd18002..78dfec9518c 100644 --- a/crates/ide/src/syntax_highlighting/test_data/injection.html +++ b/crates/ide/src/syntax_highlighting/test_data/injection.html @@ -36,13 +36,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
fn f(ra_fixture: &str) {}
-fn main() {
-    f(r"
-fn foo() {
-    foo($0{
+
fn f(ra_fixture: &str) {}
+fn main() {
+    f(r"
+fn foo() {
+    foo($0{
         92
-    }$0)
-}");
+    }$0)
+}");
 }
     
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html b/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html index 196c898f783..e64f2e5e93f 100644 --- a/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html @@ -36,15 +36,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
fn main() {
+
fn main() {
     let hello = "hello";
-    let x = hello.to_string();
-    let y = hello.to_string();
+    let x = hello.to_string();
+    let y = hello.to_string();
 
     let x = "other color please!";
-    let y = x.to_string();
+    let y = x.to_string();
 }
 
-fn bar() {
+fn bar() {
     let mut hello = "hello";
 }
\ No newline at end of file diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs index 2ddaeb17662..7f908838212 100644 --- a/crates/syntax/src/validation.rs +++ b/crates/syntax/src/validation.rs @@ -344,9 +344,9 @@ fn validate_trait_object_ty(ty: ast::DynTraitType) -> Option { if tbl.bounds().count() > 1 { let dyn_token = ty.dyn_token()?; - let potential_parentheses = + let potential_parenthesis = algo::skip_trivia_token(dyn_token.prev_token()?, Direction::Prev)?; - let kind = potential_parentheses.kind(); + let kind = potential_parenthesis.kind(); if !matches!(kind, T!['('] | T![<] | T![=]) { return Some(SyntaxError::new("ambiguous `+` in a type", ty.syntax().text_range())); }