on master help sign in
Fix clippy 1.67 warnings (#5697)
d2d3024Miguel Madrid-Mencía
helix-loader/src/config.rs+1−1
@@ -14,7 +14,7 @@ pub fn user_lang_config() -> Result<toml::Value, toml::de::Error> {
14 .chain([crate::config_dir()].into_iter())
14 .chain([crate::config_dir()].into_iter())
15 .map(|path| path.join("languages.toml"))
15 .map(|path| path.join("languages.toml"))
16 .filter_map(|file| {
16 .filter_map(|file| {
17− std::fs::read_to_string(&file)
17+ std::fs::read_to_string(file)
18 .map(|config| toml::from_str(&config))
18 .map(|config| toml::from_str(&config))
19 .ok()
19 .ok()
20 })
20 })
helix-loader/src/grammar.rs+1−1
@@ -515,5 +515,5 @@ pub fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::
515 .join("queries")
515 .join("queries")
516 .join(language)
516 .join(language)
517 .join(filename);
517 .join(filename);
518− std::fs::read_to_string(&path)
518+ std::fs::read_to_string(path)
519}
519}
helix-term/src/ui/menu.rs+1−1
@@ -77,7 +77,7 @@ impl<T: Item> Menu<T> {
77 Self {
77 Self {
78 options,
78 options,
79 editor_data,
79 editor_data,
80− matcher: Box::new(Matcher::default()),
80+ matcher: Box::default(),
81 matches,
81 matches,
82 cursor: None,
82 cursor: None,
83 widths: Vec::new(),
83 widths: Vec::new(),
helix-term/src/ui/picker.rs+1−1
@@ -431,7 +431,7 @@ impl<T: Item> Picker<T> {
431 let mut picker = Self {
431 let mut picker = Self {
432 options,
432 options,
433 editor_data,
433 editor_data,
434− matcher: Box::new(Matcher::default()),
434+ matcher: Box::default(),
435 matches: Vec::new(),
435 matches: Vec::new(),
436 cursor: 0,
436 cursor: 0,
437 prompt,
437 prompt,
helix-tui/src/buffer.rs+5−5
@@ -433,7 +433,7 @@ impl Buffer {
433 (x_offset as u16, y)
433 (x_offset as u16, y)
434 }
434 }
435
435
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) {
437 let mut remaining_width = width;
437 let mut remaining_width = width;
438 let mut x = x;
438 let mut x = x;
439 for span in &spans.0 {
439 for span in &spans.0 {
@@ -454,7 +454,7 @@ impl Buffer {
454 (x, y)
454 (x, y)
455 }
455 }
456
456
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) {
458 self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style)
458 self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style)
459 }
459 }
460
460
@@ -521,10 +521,10 @@ impl Buffer {
521 pub fn merge(&mut self, other: &Buffer) {
521 pub fn merge(&mut self, other: &Buffer) {
522 let area = self.area.union(other.area);
522 let area = self.area.union(other.area);
523 let cell: Cell = Default::default();
523 let cell: Cell = Default::default();
524− self.content.resize(area.area() as usize, cell.clone());
524+ self.content.resize(area.area(), cell.clone());
525
525
526 // Move original content to the appropriate space
526 // Move original content to the appropriate space
527− let size = self.area.area() as usize;
527+ let size = self.area.area();
528 for i in (0..size).rev() {
528 for i in (0..size).rev() {
529 let (x, y) = self.pos_of(i);
529 let (x, y) = self.pos_of(i);
530 // New index in content
530 // New index in content
@@ -537,7 +537,7 @@ impl Buffer {
537
537
538 // Push content of the other buffer into this one (may erase previous
538 // Push content of the other buffer into this one (may erase previous
539 // data)
539 // data)
540− let size = other.area.area() as usize;
540+ let size = other.area.area();
541 for i in 0..size {
541 for i in 0..size {
542 let (x, y) = other.pos_of(i);
542 let (x, y) = other.pos_of(i);
543 // New index in content
543 // New index in content
helix-view/src/theme.rs+1−1
@@ -150,7 +150,7 @@ impl Loader {
150
150
151 // Loads the theme data as `toml::Value` first from the user_dir then in default_dir
151 // Loads the theme data as `toml::Value` first from the user_dir then in default_dir
152 fn load_toml(&self, path: PathBuf) -> Result<Value> {
152 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)?;
154 let value = toml::from_str(&data)?;
154 let value = toml::from_str(&data)?;
155
155
156 Ok(value)
156 Ok(value)