Repository: sympy/sympy

Issue:
Rust printer runs wrong method
This code demonstrates the issue:

```
>>> from sympy import rust_code
>>> A = MatrixSymbol("A", 1, 3)
>>> rust_code(A[0,0])
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/lejla/sympy/sympy/printing/rust.py", line 620, in rust_code
    return RustCodePrinter(settings).doprint(expr, assign_to)
    File "/home/lejla/sympy/sympy/printing/codeprinter.py", line 81, in doprint
    lines = self._print(expr).splitlines()
    File "/home/lejla/sympy/sympy/printing/printer.py", line 257, in _print
    return getattr(self, printmethod)(expr, *args, **kwargs)
    File "/home/lejla/sympy/sympy/printing/rust.py", line 439, in _print_MatrixBase
    if A.cols == 1:
    AttributeError: 'MatrixElement' object has no attribute 'cols'
    _print_MatrixBase()` in `rust.py` is executed instead of `_print_MatrixElement()
```


Discussion:

Patch:
diff --git a/sympy/printing/rust.py b/sympy/printing/rust.py
index 5edb5b4301..fbd1470de2 100644
--- a/sympy/printing/rust.py
+++ b/sympy/printing/rust.py
@@ -454,7 +454,6 @@ def _print_MatrixElement(self, expr):
     # method from higher up the class hierarchy (see _print_NumberSymbol).
     # Then subclasses like us would not need to repeat all this.
     _print_Matrix = \
-        _print_MatrixElement = \
         _print_DenseMatrix = \
         _print_MutableDenseMatrix = \
         _print_ImmutableMatrix = \


Test patch:
diff --git a/sympy/printing/tests/test_rust.py b/sympy/printing/tests/test_rust.py
index afa0d48374..ce5cf84ad1 100644
--- a/sympy/printing/tests/test_rust.py
+++ b/sympy/printing/tests/test_rust.py
@@ -7,6 +7,7 @@
 from sympy.utilities.pytest import raises
 from sympy.utilities.lambdify import implemented_function
 from sympy.tensor import IndexedBase, Idx
+from sympy.matrices import MatrixSymbol
 
 from sympy import rust_code
 
@@ -49,6 +50,8 @@ class fabs(Abs):
         def _rust_code(self, printer):
             return "%s.fabs()" % printer._print(self.args[0])
     assert rust_code(fabs(x)) == "x.fabs()"
+    a = MatrixSymbol("a", 1 ,3)
+    assert rust_code(a[0,0]) == 'a[0]'
 
 
 def test_Functions():