mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 20:27:05 -06:00
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:
@@ -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"
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user