mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-29 23:57:51 +00:00
Fix cargo +nightly clippy
warnings
This commit is contained in:
parent
b3ae7e7657
commit
a22255bd51
6 changed files with 23 additions and 26 deletions
|
@ -55,7 +55,7 @@ impl Ord for Commit {
|
||||||
|
|
||||||
impl PartialOrd for Commit {
|
impl PartialOrd for Commit {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
Some(self.id.cmp(&other.id))
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ impl Ord for Operation {
|
||||||
|
|
||||||
impl PartialOrd for Operation {
|
impl PartialOrd for Operation {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
Some(self.id.cmp(&other.id))
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ impl Ord for View {
|
||||||
|
|
||||||
impl PartialOrd for View {
|
impl PartialOrd for View {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
Some(self.id.cmp(&other.id))
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1341,7 +1341,7 @@ impl WorkspaceCommandTransaction<'_> {
|
||||||
|
|
||||||
pub fn run_mergetool(
|
pub fn run_mergetool(
|
||||||
&self,
|
&self,
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
tree: &Tree,
|
tree: &Tree,
|
||||||
repo_path: &RepoPath,
|
repo_path: &RepoPath,
|
||||||
) -> Result<TreeId, CommandError> {
|
) -> Result<TreeId, CommandError> {
|
||||||
|
@ -1353,7 +1353,7 @@ impl WorkspaceCommandTransaction<'_> {
|
||||||
|
|
||||||
pub fn edit_diff(
|
pub fn edit_diff(
|
||||||
&self,
|
&self,
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
left_tree: &Tree,
|
left_tree: &Tree,
|
||||||
right_tree: &Tree,
|
right_tree: &Tree,
|
||||||
instructions: &str,
|
instructions: &str,
|
||||||
|
@ -1372,7 +1372,7 @@ impl WorkspaceCommandTransaction<'_> {
|
||||||
|
|
||||||
pub fn select_diff(
|
pub fn select_diff(
|
||||||
&self,
|
&self,
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
left_tree: &Tree,
|
left_tree: &Tree,
|
||||||
right_tree: &Tree,
|
right_tree: &Tree,
|
||||||
instructions: &str,
|
instructions: &str,
|
||||||
|
@ -1598,10 +1598,7 @@ pub fn print_checkout_stats(ui: &mut Ui, stats: CheckoutStats) -> Result<(), std
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_failed_git_export(
|
pub fn print_failed_git_export(ui: &Ui, failed_branches: &[RefName]) -> Result<(), std::io::Error> {
|
||||||
ui: &mut Ui,
|
|
||||||
failed_branches: &[RefName],
|
|
||||||
) -> Result<(), std::io::Error> {
|
|
||||||
if !failed_branches.is_empty() {
|
if !failed_branches.is_empty() {
|
||||||
writeln!(ui.warning(), "Failed to export some branches:")?;
|
writeln!(ui.warning(), "Failed to export some branches:")?;
|
||||||
let mut formatter = ui.stderr_formatter();
|
let mut formatter = ui.stderr_formatter();
|
||||||
|
@ -1737,7 +1734,7 @@ fn resolve_single_op_from_store(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_revset_aliases(
|
fn load_revset_aliases(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
layered_configs: &LayeredConfigs,
|
layered_configs: &LayeredConfigs,
|
||||||
) -> Result<RevsetAliasesMap, CommandError> {
|
) -> Result<RevsetAliasesMap, CommandError> {
|
||||||
const TABLE_KEY: &str = "revset-aliases";
|
const TABLE_KEY: &str = "revset-aliases";
|
||||||
|
@ -1852,7 +1849,7 @@ pub fn update_working_copy(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_template_aliases(
|
fn load_template_aliases(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
layered_configs: &LayeredConfigs,
|
layered_configs: &LayeredConfigs,
|
||||||
) -> Result<TemplateAliasesMap, CommandError> {
|
) -> Result<TemplateAliasesMap, CommandError> {
|
||||||
const TABLE_KEY: &str = "template-aliases";
|
const TABLE_KEY: &str = "template-aliases";
|
||||||
|
@ -2257,7 +2254,7 @@ impl ValueParserFactory for RevisionArg {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_default_command(
|
fn resolve_default_command(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
config: &config::Config,
|
config: &config::Config,
|
||||||
app: &Command,
|
app: &Command,
|
||||||
mut string_args: Vec<String>,
|
mut string_args: Vec<String>,
|
||||||
|
@ -2395,7 +2392,7 @@ fn handle_early_args(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expand_args(
|
pub fn expand_args(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
app: &Command,
|
app: &Command,
|
||||||
args_os: ArgsOs,
|
args_os: ArgsOs,
|
||||||
config: &config::Config,
|
config: &config::Config,
|
||||||
|
|
|
@ -326,7 +326,7 @@ fn get_single_remote(git_repo: &git2::Repository) -> Result<Option<String>, Comm
|
||||||
const DEFAULT_REMOTE: &str = "origin";
|
const DEFAULT_REMOTE: &str = "origin";
|
||||||
|
|
||||||
fn get_default_fetch_remotes(
|
fn get_default_fetch_remotes(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
command: &CommandHelper,
|
command: &CommandHelper,
|
||||||
git_repo: &git2::Repository,
|
git_repo: &git2::Repository,
|
||||||
) -> Result<Vec<String>, CommandError> {
|
) -> Result<Vec<String>, CommandError> {
|
||||||
|
@ -915,7 +915,7 @@ fn cmd_git_push(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_default_push_remote(
|
fn get_default_push_remote(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
command: &CommandHelper,
|
command: &CommandHelper,
|
||||||
git_repo: &git2::Repository,
|
git_repo: &git2::Repository,
|
||||||
) -> Result<String, CommandError> {
|
) -> Result<String, CommandError> {
|
||||||
|
|
|
@ -1010,7 +1010,7 @@ struct UtilMangenArgs {}
|
||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct UtilConfigSchemaArgs {}
|
struct UtilConfigSchemaArgs {}
|
||||||
|
|
||||||
fn add_to_git_exclude(ui: &mut Ui, git_repo: &git2::Repository) -> Result<(), CommandError> {
|
fn add_to_git_exclude(ui: &Ui, git_repo: &git2::Repository) -> Result<(), CommandError> {
|
||||||
let exclude_file_path = git_repo.path().join("info").join("exclude");
|
let exclude_file_path = git_repo.path().join("info").join("exclude");
|
||||||
if exclude_file_path.exists() {
|
if exclude_file_path.exists() {
|
||||||
match fs::OpenOptions::new()
|
match fs::OpenOptions::new()
|
||||||
|
|
|
@ -153,7 +153,7 @@ fn set_readonly_recursively(path: &Path) -> Result<(), std::io::Error> {
|
||||||
// TODO: Rearrange the functions. This should be on the bottom, options should
|
// TODO: Rearrange the functions. This should be on the bottom, options should
|
||||||
// be on the top.
|
// be on the top.
|
||||||
pub fn run_mergetool(
|
pub fn run_mergetool(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
tree: &Tree,
|
tree: &Tree,
|
||||||
repo_path: &RepoPath,
|
repo_path: &RepoPath,
|
||||||
settings: &UserSettings,
|
settings: &UserSettings,
|
||||||
|
@ -296,7 +296,7 @@ fn interpolate_variables<V: AsRef<str>>(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn edit_diff(
|
pub fn edit_diff(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
left_tree: &Tree,
|
left_tree: &Tree,
|
||||||
right_tree: &Tree,
|
right_tree: &Tree,
|
||||||
instructions: &str,
|
instructions: &str,
|
||||||
|
@ -464,7 +464,7 @@ fn get_tool_config(settings: &UserSettings, name: &str) -> Result<Option<MergeTo
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_diff_editor_from_settings(
|
fn get_diff_editor_from_settings(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
settings: &UserSettings,
|
settings: &UserSettings,
|
||||||
) -> Result<MergeTool, ExternalToolError> {
|
) -> Result<MergeTool, ExternalToolError> {
|
||||||
let args = editor_args_from_settings(ui, settings, "ui.diff-editor")?;
|
let args = editor_args_from_settings(ui, settings, "ui.diff-editor")?;
|
||||||
|
@ -477,7 +477,7 @@ fn get_diff_editor_from_settings(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_merge_tool_from_settings(
|
fn get_merge_tool_from_settings(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
settings: &UserSettings,
|
settings: &UserSettings,
|
||||||
) -> Result<MergeTool, ExternalToolError> {
|
) -> Result<MergeTool, ExternalToolError> {
|
||||||
let args = editor_args_from_settings(ui, settings, "ui.merge-editor")?;
|
let args = editor_args_from_settings(ui, settings, "ui.merge-editor")?;
|
||||||
|
@ -498,7 +498,7 @@ fn get_merge_tool_from_settings(
|
||||||
|
|
||||||
/// Finds the appropriate tool for diff editing or merges
|
/// Finds the appropriate tool for diff editing or merges
|
||||||
fn editor_args_from_settings(
|
fn editor_args_from_settings(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
settings: &UserSettings,
|
settings: &UserSettings,
|
||||||
key: &str,
|
key: &str,
|
||||||
) -> Result<CommandNameAndArgs, ExternalToolError> {
|
) -> Result<CommandNameAndArgs, ExternalToolError> {
|
||||||
|
@ -533,9 +533,9 @@ mod tests {
|
||||||
fn test_get_diff_editor() {
|
fn test_get_diff_editor() {
|
||||||
let get = |text| {
|
let get = |text| {
|
||||||
let config = config_from_string(text);
|
let config = config_from_string(text);
|
||||||
let mut ui = Ui::with_config(&config).unwrap();
|
let ui = Ui::with_config(&config).unwrap();
|
||||||
let settings = UserSettings::from_config(config);
|
let settings = UserSettings::from_config(config);
|
||||||
get_diff_editor_from_settings(&mut ui, &settings)
|
get_diff_editor_from_settings(&ui, &settings)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
|
@ -663,9 +663,9 @@ mod tests {
|
||||||
fn test_get_merge_tool() {
|
fn test_get_merge_tool() {
|
||||||
let get = |text| {
|
let get = |text| {
|
||||||
let config = config_from_string(text);
|
let config = config_from_string(text);
|
||||||
let mut ui = Ui::with_config(&config).unwrap();
|
let ui = Ui::with_config(&config).unwrap();
|
||||||
let settings = UserSettings::from_config(config);
|
let settings = UserSettings::from_config(config);
|
||||||
get_merge_tool_from_settings(&mut ui, &settings)
|
get_merge_tool_from_settings(&ui, &settings)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
|
|
Loading…
Reference in a new issue