on master help sign in
Fix clippy 1.67 warnings (#5697)
commitd2d302433747ba04dc2fa541c4da9e878d4a5886 authorMiguel Madrid-Mencía <miguel.madrid.mencia@gmail.com> dateFri 27 Jan 2023, 16:43 (4 years ago) parent4d548a0
6 files changed+10−10
helix-loader/src/config.rs+1−1 helix-loader/src/grammar.rs+1−1 helix-term/src/ui/menu.rs+1−1 helix-term/src/ui/picker.rs+1−1 helix-tui/src/buffer.rs+5−5 helix-view/src/theme.rs+1−1
helix-loader/src/config.rs+1−1
@@ -14,7 +14,7 @@ pub fn user_lang_config() -> Result<toml::Value, toml::de::Error> {
1414 .chain([crate::config_dir()].into_iter())
1515 .map(|path| path.join("languages.toml"))
1616 .filter_map(|file| {
17− std::fs::read_to_string(&file)
17+ std::fs::read_to_string(file)
1818 .map(|config| toml::from_str(&config))
1919 .ok()
2020 })
helix-loader/src/grammar.rs+1−1
@@ -515,5 +515,5 @@ pub fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::
515515 .join("queries")
516516 .join(language)
517517 .join(filename);
518− std::fs::read_to_string(&path)
518+ std::fs::read_to_string(path)
519519}
helix-term/src/ui/menu.rs+1−1
@@ -77,7 +77,7 @@ impl<T: Item> Menu<T> {
7777 Self {
7878 options,
7979 editor_data,
80− matcher: Box::new(Matcher::default()),
80+ matcher: Box::default(),
8181 matches,
8282 cursor: None,
8383 widths: Vec::new(),
helix-term/src/ui/picker.rs+1−1
@@ -431,7 +431,7 @@ impl<T: Item> Picker<T> {
431431 let mut picker = Self {
432432 options,
433433 editor_data,
434− matcher: Box::new(Matcher::default()),
434+ matcher: Box::default(),
435435 matches: Vec::new(),
436436 cursor: 0,
437437 prompt,
helix-tui/src/buffer.rs+5−5
@@ -433,7 +433,7 @@ impl Buffer {
433433 (x_offset as u16, y)
434434 }
435435
436− pub fn set_spans<'a>(&mut self, x: u16, y: u16, spans: &Spans<'a>, width: u16) -> (u16, u16) {
436+ pub fn set_spans(&mut self, x: u16, y: u16, spans: &Spans, width: u16) -> (u16, u16) {
437437 let mut remaining_width = width;
438438 let mut x = x;
439439 for span in &spans.0 {
@@ -454,7 +454,7 @@ impl Buffer {
454454 (x, y)
455455 }
456456
457− pub fn set_span<'a>(&mut self, x: u16, y: u16, span: &Span<'a>, width: u16) -> (u16, u16) {
457+ pub fn set_span(&mut self, x: u16, y: u16, span: &Span, width: u16) -> (u16, u16) {
458458 self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style)
459459 }
460460
@@ -521,10 +521,10 @@ impl Buffer {
521521 pub fn merge(&mut self, other: &Buffer) {
522522 let area = self.area.union(other.area);
523523 let cell: Cell = Default::default();
524− self.content.resize(area.area() as usize, cell.clone());
524+ self.content.resize(area.area(), cell.clone());
525525
526526 // Move original content to the appropriate space
527− let size = self.area.area() as usize;
527+ let size = self.area.area();
528528 for i in (0..size).rev() {
529529 let (x, y) = self.pos_of(i);
530530 // New index in content
@@ -537,7 +537,7 @@ impl Buffer {
537537
538538 // Push content of the other buffer into this one (may erase previous
539539 // data)
540− let size = other.area.area() as usize;
540+ let size = other.area.area();
541541 for i in 0..size {
542542 let (x, y) = other.pos_of(i);
543543 // New index in content
helix-view/src/theme.rs+1−1
@@ -150,7 +150,7 @@ impl Loader {
150150
151151 // Loads the theme data as `toml::Value` first from the user_dir then in default_dir
152152 fn load_toml(&self, path: PathBuf) -> Result<Value> {
153− let data = std::fs::read_to_string(&path)?;
153+ let data = std::fs::read_to_string(path)?;
154154 let value = toml::from_str(&data)?;
155155
156156 Ok(value)