Skip to content

Commit

Permalink
fix(cargo): prevent crate filename collision
Browse files Browse the repository at this point in the history
`cargo` has a bug that prevents correct handling of similarly named
crates in the same package. Rename the internal library crate to prevent
error messages. rust-lang/cargo#10368
  • Loading branch information
ThomasFrans committed Feb 9, 2024
1 parent 38010b4 commit fbe866e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ inherits = "release"
lto = false
codegen-units = 16

[lib]
name = "ncspot_common"

[dependencies]
chrono = "0.4"
clap = "4.4.18"
Expand Down
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use cursive::traits::View;
use cursive::views::Dialog;
use cursive::Cursive;
use log::{debug, error, info};
use ncspot::CONFIGURATION_FILE_NAME;
use ncspot_common::CONFIGURATION_FILE_NAME;
use std::cell::RefCell;

pub enum CommandResult {
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{fs, process};

use cursive::theme::Theme;
use log::{debug, error};
use ncspot::{CONFIGURATION_FILE_NAME, USER_STATE_FILE_NAME};
use ncspot_common::{CONFIGURATION_FILE_NAME, USER_STATE_FILE_NAME};
use platform_dirs::AppDirs;

use crate::command::{SortDirection, SortKey};
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{path::PathBuf, process::exit};
use application::{setup_logging, Application};
use config::set_configuration_base_path;
use log::error;
use ncspot::program_arguments;
use ncspot_common::program_arguments;

mod application;
mod authentication;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cursive::utils::markup::StyledString;
use cursive::view::ViewWrapper;
use cursive::views::{ScrollView, TextView};
use cursive::Cursive;
use ncspot::CONFIGURATION_FILE_NAME;
use ncspot_common::CONFIGURATION_FILE_NAME;

use crate::command::{Command, MoveAmount, MoveMode};
use crate::commands::CommandResult;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cursive::{Cursive, CursiveRunner};
use ncspot::BIN_NAME;
use ncspot_common::BIN_NAME;

pub mod album;
pub mod artist;
Expand Down
6 changes: 3 additions & 3 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use clap::builder::PathBufValueParser;
use clap::error::{Error, ErrorKind};
use clap::ArgMatches;
use clap_complete::Shell;
use ncspot::{AUTHOR, BIN_NAME};
use ncspot_common::{AUTHOR, BIN_NAME};

static DEFAULT_OUTPUT_DIRECTORY: &str = "misc";

Expand Down Expand Up @@ -109,7 +109,7 @@ fn generate_manpage(subcommand_arguments: &ArgMatches) -> Result<(), DynError> {
let output_directory = subcommand_arguments
.get_one::<PathBuf>("output")
.unwrap_or(&default_output_directory);
let cmd = ncspot::program_arguments();
let cmd = ncspot_common::program_arguments();
let man = clap_mangen::Man::new(cmd);
let mut buffer: Vec<u8> = Default::default();

Expand Down Expand Up @@ -154,7 +154,7 @@ fn generate_shell_completion(subcommand_arguments: &ArgMatches) -> Result<(), Dy
for shell in shells {
clap_complete::generate_to(
shell,
&mut ncspot::program_arguments(),
&mut ncspot_common::program_arguments(),
BIN_NAME,
output_directory,
)?;
Expand Down

0 comments on commit fbe866e

Please sign in to comment.