lint: method references and elided const lifetimes (S1612, S8863) (#4204)

Use function paths where a closure only forwarded its argument
(PoisonError::into_inner, OsStr::to_str, FindRange::is_empty), and drop
redundant 'static on associated and module consts. No behaviour change.
This commit is contained in:
Dylan M. Taylor
2026-10-25 22:08:44 -04:00
committed by GitHub
parent 6b5ba89cd0
commit 46ece73197
9 changed files with 22 additions and 21 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ impl<'a> Collector<'a> {
/// Warns when a file that placed `.ai` file `source` links (`name`) was copied as `copy`: the
/// copy of `source` finds it only by its name, beside it.
fn renamed(&mut self, lines: &mut Vec<String>, source: &str, path: &str, name: &str, copy: &str) {
if Path::new(copy).file_name().and_then(|n| n.to_str()) != Some(name) {
if Path::new(copy).file_name().and_then(std::ffi::OsStr::to_str) != Some(name) {
let message = format!(
"{path}: copied as {copy}; the copy of {source} looks for it as {name} and shows the file of that name, if any, else its preview"
);
+1 -1
View File
@@ -603,7 +603,7 @@ struct Names {
/// The name of the entry holding `bytes`: from their content (128 bits of hash and the length), so
/// identical images share one entry and one written before isn't written again.
fn blob_name(bytes: &Arc<Vec<u8>>) -> String {
let mut guard = NAMES.lock().unwrap_or_else(|e| e.into_inner());
let mut guard = NAMES.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
let Names { by_address, live_after_sweep } = &mut *guard;
let names = by_address.get_or_insert_with(Default::default);
let address = Arc::as_ptr(bytes) as usize;
+1 -1
View File
@@ -127,7 +127,7 @@ impl SymbolLibrary {
}
impl LibraryFile for SymbolLibrary {
const EXTS: &'static [&'static str] = &[SYMBOLS_EXT];
const EXTS: &[&str] = &[SYMBOLS_EXT];
fn read(bytes: &[u8], stem: &str) -> std::result::Result<Self, String> {
let doc = vectorcraft_format::load(bytes).map_err(|e| e.to_string())?;
SymbolLibrary::from_document(&doc, &[], stem.to_string())