I apologize for my previous response not feeling very accurate. Here is a function in Rust for performing a bubble sort, formatted correctly:
```rust
fn bubble_sort(arr: &mut [i32]) {
  let n = arr.len();
  for i in 0..n {
    for j in 0..(n - i - 1) {
      if arr[j] > arr[j + 1] {
        arr.swap(j, j + 1);
      }
    }
  }
}
```
If you have any questions about this particular variation of the code, feel free to ask!
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence