mirror of
https://git.um-react.app/um/lib_um_crypto_rust.git
synced 2026-03-07 20:19:51 +00:00
fix: address clippy warnings
This commit is contained in:
@@ -48,7 +48,7 @@ impl ArgsKGM {
|
||||
let mut file_input = File::open(&self.input)?;
|
||||
let mut header = [0u8; 0x40];
|
||||
file_input.read_exact(&mut header)?;
|
||||
let kgm_header = Header::from_buffer(&mut header)?;
|
||||
let kgm_header = Header::from_buffer(header)?;
|
||||
let decipher = Decipher::new(&kgm_header)?;
|
||||
file_input.seek(SeekFrom::Start(kgm_header.offset_to_data as u64))?;
|
||||
|
||||
|
||||
@@ -13,16 +13,16 @@ pub mod xmly;
|
||||
#[derive(Subcommand)]
|
||||
pub enum Commands {
|
||||
#[command(name = "ncm")]
|
||||
NCM(ncm::ArgsNCM),
|
||||
Ncm(ncm::ArgsNCM),
|
||||
|
||||
#[command(name = "kgm")]
|
||||
KGM(kgm::ArgsKGM),
|
||||
Kgm(kgm::ArgsKGM),
|
||||
|
||||
#[command(name = "mg3d")]
|
||||
Migu3D(mg3d::ArgsMigu3D),
|
||||
|
||||
#[command(name = "joox")]
|
||||
JOOX(joox::ArgsJoox),
|
||||
Joox(joox::ArgsJoox),
|
||||
|
||||
#[command(name = "qmc1")]
|
||||
QMCv1(qmc1::ArgsQMCv1),
|
||||
@@ -30,11 +30,11 @@ pub enum Commands {
|
||||
QMCv2(qmc2::ArgsQMCv2),
|
||||
|
||||
#[command(name = "qtfm")]
|
||||
QTFM(qtfm::ArgsQingTingFM),
|
||||
QtFM(qtfm::ArgsQingTingFM),
|
||||
|
||||
#[command(name = "xiami")]
|
||||
Xiami(xiami::ArgsXiami),
|
||||
|
||||
#[command(name = "xmly")]
|
||||
XMLY(xmly::ArgsXimalaya),
|
||||
Xmly(xmly::ArgsXimalaya),
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ impl ArgsNCM {
|
||||
fn write_cover(&self, cli: &Cli, ncm: &NCMFile) -> anyhow::Result<()> {
|
||||
if let Some(cover_path) = &self.cover {
|
||||
if let Some(cover) = &ncm.image1 {
|
||||
File::create(cover_path)?.write_all(&cover)?;
|
||||
File::create(cover_path)?.write_all(cover)?;
|
||||
if cli.verbose {
|
||||
let cover_path = cover_path.display();
|
||||
let len = cover.len();
|
||||
|
||||
@@ -48,8 +48,8 @@ impl ArgsQingTingFM {
|
||||
let iv = make_decipher_iv(&file_name)?;
|
||||
if cli.verbose {
|
||||
eprintln!(" file_name: {}", file_name);
|
||||
eprintln!("device_key: {}", hex::encode(&device_key));
|
||||
eprintln!(" file_iv: {}", hex::encode(&iv));
|
||||
eprintln!("device_key: {}", hex::encode(device_key));
|
||||
eprintln!(" file_iv: {}", hex::encode(iv));
|
||||
}
|
||||
|
||||
let decipher = Decipher::new(&device_key, &iv);
|
||||
|
||||
@@ -28,15 +28,15 @@ pub struct Cli {
|
||||
|
||||
fn run_command(cli: &Cli) -> Result<i32> {
|
||||
match &cli.command {
|
||||
Some(Commands::JOOX(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::KGM(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::Migu3D(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::NCM(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::QMCv1(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::QMCv2(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::QTFM(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::Xiami(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::XMLY(cmd)) => cmd.run(&cli),
|
||||
Some(Commands::Joox(cmd)) => cmd.run(cli),
|
||||
Some(Commands::Kgm(cmd)) => cmd.run(cli),
|
||||
Some(Commands::Migu3D(cmd)) => cmd.run(cli),
|
||||
Some(Commands::Ncm(cmd)) => cmd.run(cli),
|
||||
Some(Commands::QMCv1(cmd)) => cmd.run(cli),
|
||||
Some(Commands::QMCv2(cmd)) => cmd.run(cli),
|
||||
Some(Commands::QtFM(cmd)) => cmd.run(cli),
|
||||
Some(Commands::Xiami(cmd)) => cmd.run(cli),
|
||||
Some(Commands::Xmly(cmd)) => cmd.run(cli),
|
||||
None => {
|
||||
// https://github.com/clap-rs/clap/issues/3857#issuecomment-1161796261
|
||||
todo!("implement a sensible default command, similar to um/cli");
|
||||
|
||||
Reference in New Issue
Block a user