fix(rust): adapt to new nightly lint
This commit is contained in:
parent
066fd77d39
commit
11071ed682
7 changed files with 37 additions and 25 deletions
|
|
@ -561,8 +561,8 @@ impl Loader {
|
|||
// If multiple language configurations match, then determine which
|
||||
// one to use by applying the configurations' content regexes.
|
||||
else {
|
||||
let file_contents =
|
||||
fs::read(path).with_context(|| format!("Failed to read path {path:?}"))?;
|
||||
let file_contents = fs::read(path)
|
||||
.with_context(|| format!("Failed to read path {}", path.display()))?;
|
||||
let file_contents = String::from_utf8_lossy(&file_contents);
|
||||
let mut best_score = -2isize;
|
||||
let mut best_configuration_id = None;
|
||||
|
|
@ -780,8 +780,8 @@ impl Loader {
|
|||
if recompile {
|
||||
fs::create_dir_all(lock_path.parent().unwrap()).with_context(|| {
|
||||
format!(
|
||||
"Failed to create directory {:?}",
|
||||
lock_path.parent().unwrap()
|
||||
"Failed to create directory {}",
|
||||
lock_path.parent().unwrap().display()
|
||||
)
|
||||
})?;
|
||||
let lock_file = fs::OpenOptions::new()
|
||||
|
|
@ -799,7 +799,7 @@ impl Loader {
|
|||
}
|
||||
|
||||
let library = unsafe { Library::new(&output_path) }
|
||||
.with_context(|| format!("Error opening dynamic library {output_path:?}"))?;
|
||||
.with_context(|| format!("Error opening dynamic library {}", output_path.display()))?;
|
||||
let language = unsafe {
|
||||
let language_fn = library
|
||||
.get::<Symbol<unsafe extern "C" fn() -> Language>>(language_fn_name.as_bytes())
|
||||
|
|
@ -1564,7 +1564,7 @@ impl LanguageConfiguration<'_> {
|
|||
error.row = source[range.start..offset_within_section]
|
||||
.matches('\n')
|
||||
.count();
|
||||
Error::from(error).context(format!("Error in query file {path:?}"))
|
||||
Error::from(error).context(format!("Error in query file {}", path.display()))
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
|
|
@ -1581,7 +1581,7 @@ impl LanguageConfiguration<'_> {
|
|||
let abs_path = self.root_path.join(path);
|
||||
let prev_query_len = query.len();
|
||||
query += &fs::read_to_string(&abs_path)
|
||||
.with_context(|| format!("Failed to read query file {path:?}"))?;
|
||||
.with_context(|| format!("Failed to read query file {}", path.display()))?;
|
||||
path_ranges.push((path.clone(), prev_query_len..query.len()));
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1599,7 +1599,7 @@ impl LanguageConfiguration<'_> {
|
|||
let path = queries_path.join(default_path);
|
||||
if path.exists() {
|
||||
query = fs::read_to_string(&path)
|
||||
.with_context(|| format!("Failed to read query file {path:?}"))?;
|
||||
.with_context(|| format!("Failed to read query file {}", path.display()))?;
|
||||
path_ranges.push((PathBuf::from(default_path), 0..query.len()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1612,8 +1612,8 @@ fn needs_recompile(lib_path: &Path, paths_to_check: &[PathBuf]) -> Result<bool>
|
|||
if !lib_path.exists() {
|
||||
return Ok(true);
|
||||
}
|
||||
let lib_mtime =
|
||||
mtime(lib_path).with_context(|| format!("Failed to read mtime of {lib_path:?}"))?;
|
||||
let lib_mtime = mtime(lib_path)
|
||||
.with_context(|| format!("Failed to read mtime of {}", lib_path.display()))?;
|
||||
for path in paths_to_check {
|
||||
if mtime(path)? > lib_mtime {
|
||||
return Ok(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue