Created
March 7, 2022 14:38
-
-
Save metasim/d05f7b305752a08411efc3674c61cc2f to your computer and use it in GitHub Desktop.
Error reporting bug in JetBrains Rust Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "ext-err" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
extend = "1.1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use extend::ext; | |
#[ext] | |
impl<T> Vec<T> { | |
fn scramble(mut self) -> Self { | |
let len = self.len(); | |
self.swap(0, len/2); | |
self | |
} | |
} | |
fn main() { | |
let nums = vec![1, 2, 3, 4, 5]; | |
println!("{:?}", nums.scramble()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment