remove uses of to_owned (#764)

* remove uses of to_owned

* more

* more
This commit is contained in:
Logan McNaughton 2026-04-17 09:59:32 +02:00 committed by GitHub
parent 28aa8ea280
commit a592d0eb84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 20 deletions

View File

@ -62,11 +62,10 @@ fn main() {
.include("parallel-rdp/parallel-rdp-standalone/vulkan-headers/include")
.include("parallel-rdp/parallel-rdp-standalone/util")
.include(
std::path::PathBuf::from(std::env::var("DEP_SDL3_OUT_DIR").to_owned().unwrap())
.join("include"),
std::path::PathBuf::from(std::env::var("DEP_SDL3_OUT_DIR").unwrap()).join("include"),
)
.include(
std::path::PathBuf::from(std::env::var("DEP_SDL3_TTF_OUT_DIR").to_owned().unwrap())
std::path::PathBuf::from(std::env::var("DEP_SDL3_TTF_OUT_DIR").unwrap())
.join("include"),
);

View File

@ -85,7 +85,7 @@ pub fn send_save(netplay: &mut Netplay, save_type: &str, save_data: &[u8], size:
request.extend_from_slice(&(size as u32).to_be_bytes());
if size > 0 {
request.extend(save_data.to_owned());
request.extend_from_slice(save_data);
}
netplay.tcp_stream.write_all(&request).unwrap();
}

View File

@ -135,13 +135,13 @@ pub fn get_game_crc(rom: &[u8]) -> String {
}
pub fn get_game_name(rom: &[u8]) -> String {
let mut game_name = "".to_owned();
let header_value = std::str::from_utf8(&rom[0x20..0x34]);
if let Ok(header_value) = header_value {
let re = regex::Regex::new(r"[^a-zA-Z0-9_ -]").unwrap();
game_name = re.replace_all(header_value, "").trim().replace('\0', "");
re.replace_all(header_value, "").trim().replace('\0', "")
} else {
String::new()
}
game_name
}
pub fn init(ui: &mut ui::Ui, rom: &[u8]) {
@ -163,49 +163,46 @@ pub fn init(ui: &mut ui::Ui, rom: &[u8]) {
ui.storage
.paths
.eep_file_path
.push(prefix.to_owned() + "-" + &ui.game_hash + ".eep");
.push(format!("{}-{}.eep", prefix, ui.game_hash));
ui.storage.paths.sra_file_path.clone_from(&saves_path);
ui.storage
.paths
.sra_file_path
.push(prefix.to_owned() + "-" + &ui.game_hash + ".sra");
.push(format!("{}-{}.sra", prefix, ui.game_hash));
ui.storage.paths.fla_file_path.clone_from(&saves_path);
ui.storage
.paths
.fla_file_path
.push(prefix.to_owned() + "-" + &ui.game_hash + ".fla");
.push(format!("{}-{}.fla", prefix, ui.game_hash));
ui.storage.paths.pak_file_path.clone_from(&saves_path);
ui.storage
.paths
.pak_file_path
.push(prefix.to_owned() + "-" + &ui.game_hash + ".mpk");
.push(format!("{}-{}.mpk", prefix, ui.game_hash));
ui.storage.paths.sdcard_file_path.clone_from(&saves_path);
ui.storage
.paths
.sdcard_file_path
.push(prefix.to_owned() + "-" + &ui.game_hash + ".img");
.push(format!("{}-{}.img", prefix, ui.game_hash));
ui.storage.paths.romsave_file_path.clone_from(&saves_path);
ui.storage
.paths
.romsave_file_path
.push(prefix.to_owned() + "-" + &ui.game_hash + ".romsave");
.push(format!("{}-{}.romsave", prefix, ui.game_hash));
ui.storage
.paths
.savestate_file_path
.clone_from(&states_path);
ui.storage.paths.savestate_file_path.push(
prefix.to_owned()
+ "-"
+ &ui.game_hash
+ ".state"
+ ui.storage.save_state_slot.to_string().as_str(),
);
ui.storage.paths.savestate_file_path.push(format!(
"{}-{}.state{}",
prefix, ui.game_hash, ui.storage.save_state_slot
));
}
pub fn load_saves(ui: &mut ui::Ui, netplay: &mut Option<netplay::Netplay>) {