1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-05-05 23:06:04 +02:00

Fix clippy 1.67 warnings (#5697)

This commit is contained in:
Miguel Madrid-Mencía 2023-01-27 16:43:46 +01:00 committed by GitHub
parent 4d548a0ee3
commit d2d3024337
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,7 @@ pub fn user_lang_config() -> Result<toml::Value, toml::de::Error> {
.chain([crate::config_dir()].into_iter()) .chain([crate::config_dir()].into_iter())
.map(|path| path.join("languages.toml")) .map(|path| path.join("languages.toml"))
.filter_map(|file| { .filter_map(|file| {
std::fs::read_to_string(&file) std::fs::read_to_string(file)
.map(|config| toml::from_str(&config)) .map(|config| toml::from_str(&config))
.ok() .ok()
}) })

View File

@ -515,5 +515,5 @@ pub fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::
.join("queries") .join("queries")
.join(language) .join(language)
.join(filename); .join(filename);
std::fs::read_to_string(&path) std::fs::read_to_string(path)
} }

View File

@ -77,7 +77,7 @@ pub fn new(
Self { Self {
options, options,
editor_data, editor_data,
matcher: Box::new(Matcher::default()), matcher: Box::default(),
matches, matches,
cursor: None, cursor: None,
widths: Vec::new(), widths: Vec::new(),

View File

@ -431,7 +431,7 @@ pub fn new(
let mut picker = Self { let mut picker = Self {
options, options,
editor_data, editor_data,
matcher: Box::new(Matcher::default()), matcher: Box::default(),
matches: Vec::new(), matches: Vec::new(),
cursor: 0, cursor: 0,
prompt, prompt,

View File

@ -433,7 +433,7 @@ pub fn set_string_truncated_at_end(
(x_offset as u16, y) (x_offset as u16, y)
} }
pub fn set_spans<'a>(&mut self, x: u16, y: u16, spans: &Spans<'a>, width: u16) -> (u16, u16) { pub fn set_spans(&mut self, x: u16, y: u16, spans: &Spans, width: u16) -> (u16, u16) {
let mut remaining_width = width; let mut remaining_width = width;
let mut x = x; let mut x = x;
for span in &spans.0 { for span in &spans.0 {
@ -454,7 +454,7 @@ pub fn set_spans<'a>(&mut self, x: u16, y: u16, spans: &Spans<'a>, width: u16) -
(x, y) (x, y)
} }
pub fn set_span<'a>(&mut self, x: u16, y: u16, span: &Span<'a>, width: u16) -> (u16, u16) { pub fn set_span(&mut self, x: u16, y: u16, span: &Span, width: u16) -> (u16, u16) {
self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style) self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style)
} }
@ -521,10 +521,10 @@ pub fn clear_with(&mut self, area: Rect, style: Style) {
pub fn merge(&mut self, other: &Buffer) { pub fn merge(&mut self, other: &Buffer) {
let area = self.area.union(other.area); let area = self.area.union(other.area);
let cell: Cell = Default::default(); let cell: Cell = Default::default();
self.content.resize(area.area() as usize, cell.clone()); self.content.resize(area.area(), cell.clone());
// Move original content to the appropriate space // Move original content to the appropriate space
let size = self.area.area() as usize; let size = self.area.area();
for i in (0..size).rev() { for i in (0..size).rev() {
let (x, y) = self.pos_of(i); let (x, y) = self.pos_of(i);
// New index in content // New index in content
@ -537,7 +537,7 @@ pub fn merge(&mut self, other: &Buffer) {
// Push content of the other buffer into this one (may erase previous // Push content of the other buffer into this one (may erase previous
// data) // data)
let size = other.area.area() as usize; let size = other.area.area();
for i in 0..size { for i in 0..size {
let (x, y) = other.pos_of(i); let (x, y) = other.pos_of(i);
// New index in content // New index in content

View File

@ -150,7 +150,7 @@ fn merge_themes(&self, parent_theme_toml: Value, theme_toml: Value) -> Value {
// Loads the theme data as `toml::Value` first from the user_dir then in default_dir // Loads the theme data as `toml::Value` first from the user_dir then in default_dir
fn load_toml(&self, path: PathBuf) -> Result<Value> { fn load_toml(&self, path: PathBuf) -> Result<Value> {
let data = std::fs::read_to_string(&path)?; let data = std::fs::read_to_string(path)?;
let value = toml::from_str(&data)?; let value = toml::from_str(&data)?;
Ok(value) Ok(value)