ok/jj
1
0
Fork 0
forked from mirrors/jj

Fix cargo +nightly clippy warnings

This commit is contained in:
Ilya Grigoriev 2023-07-28 18:59:41 -07:00
parent b3ae7e7657
commit a22255bd51
6 changed files with 23 additions and 26 deletions

View file

@ -55,7 +55,7 @@ impl Ord for Commit {
impl PartialOrd for Commit {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.id.cmp(&other.id))
Some(self.cmp(other))
}
}

View file

@ -53,7 +53,7 @@ impl Ord for Operation {
impl PartialOrd for Operation {
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 {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.id.cmp(&other.id))
Some(self.cmp(other))
}
}

View file

@ -1341,7 +1341,7 @@ impl WorkspaceCommandTransaction<'_> {
pub fn run_mergetool(
&self,
ui: &mut Ui,
ui: &Ui,
tree: &Tree,
repo_path: &RepoPath,
) -> Result<TreeId, CommandError> {
@ -1353,7 +1353,7 @@ impl WorkspaceCommandTransaction<'_> {
pub fn edit_diff(
&self,
ui: &mut Ui,
ui: &Ui,
left_tree: &Tree,
right_tree: &Tree,
instructions: &str,
@ -1372,7 +1372,7 @@ impl WorkspaceCommandTransaction<'_> {
pub fn select_diff(
&self,
ui: &mut Ui,
ui: &Ui,
left_tree: &Tree,
right_tree: &Tree,
instructions: &str,
@ -1598,10 +1598,7 @@ pub fn print_checkout_stats(ui: &mut Ui, stats: CheckoutStats) -> Result<(), std
Ok(())
}
pub fn print_failed_git_export(
ui: &mut Ui,
failed_branches: &[RefName],
) -> Result<(), std::io::Error> {
pub fn print_failed_git_export(ui: &Ui, failed_branches: &[RefName]) -> Result<(), std::io::Error> {
if !failed_branches.is_empty() {
writeln!(ui.warning(), "Failed to export some branches:")?;
let mut formatter = ui.stderr_formatter();
@ -1737,7 +1734,7 @@ fn resolve_single_op_from_store(
}
fn load_revset_aliases(
ui: &mut Ui,
ui: &Ui,
layered_configs: &LayeredConfigs,
) -> Result<RevsetAliasesMap, CommandError> {
const TABLE_KEY: &str = "revset-aliases";
@ -1852,7 +1849,7 @@ pub fn update_working_copy(
}
fn load_template_aliases(
ui: &mut Ui,
ui: &Ui,
layered_configs: &LayeredConfigs,
) -> Result<TemplateAliasesMap, CommandError> {
const TABLE_KEY: &str = "template-aliases";
@ -2257,7 +2254,7 @@ impl ValueParserFactory for RevisionArg {
}
fn resolve_default_command(
ui: &mut Ui,
ui: &Ui,
config: &config::Config,
app: &Command,
mut string_args: Vec<String>,
@ -2395,7 +2392,7 @@ fn handle_early_args(
}
pub fn expand_args(
ui: &mut Ui,
ui: &Ui,
app: &Command,
args_os: ArgsOs,
config: &config::Config,

View file

@ -326,7 +326,7 @@ fn get_single_remote(git_repo: &git2::Repository) -> Result<Option<String>, Comm
const DEFAULT_REMOTE: &str = "origin";
fn get_default_fetch_remotes(
ui: &mut Ui,
ui: &Ui,
command: &CommandHelper,
git_repo: &git2::Repository,
) -> Result<Vec<String>, CommandError> {
@ -915,7 +915,7 @@ fn cmd_git_push(
}
fn get_default_push_remote(
ui: &mut Ui,
ui: &Ui,
command: &CommandHelper,
git_repo: &git2::Repository,
) -> Result<String, CommandError> {

View file

@ -1010,7 +1010,7 @@ struct UtilMangenArgs {}
#[derive(clap::Args, Clone, Debug)]
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");
if exclude_file_path.exists() {
match fs::OpenOptions::new()

View file

@ -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
// be on the top.
pub fn run_mergetool(
ui: &mut Ui,
ui: &Ui,
tree: &Tree,
repo_path: &RepoPath,
settings: &UserSettings,
@ -296,7 +296,7 @@ fn interpolate_variables<V: AsRef<str>>(
}
pub fn edit_diff(
ui: &mut Ui,
ui: &Ui,
left_tree: &Tree,
right_tree: &Tree,
instructions: &str,
@ -464,7 +464,7 @@ fn get_tool_config(settings: &UserSettings, name: &str) -> Result<Option<MergeTo
}
fn get_diff_editor_from_settings(
ui: &mut Ui,
ui: &Ui,
settings: &UserSettings,
) -> Result<MergeTool, ExternalToolError> {
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(
ui: &mut Ui,
ui: &Ui,
settings: &UserSettings,
) -> Result<MergeTool, ExternalToolError> {
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
fn editor_args_from_settings(
ui: &mut Ui,
ui: &Ui,
settings: &UserSettings,
key: &str,
) -> Result<CommandNameAndArgs, ExternalToolError> {
@ -533,9 +533,9 @@ mod tests {
fn test_get_diff_editor() {
let get = |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);
get_diff_editor_from_settings(&mut ui, &settings)
get_diff_editor_from_settings(&ui, &settings)
};
// Default
@ -663,9 +663,9 @@ mod tests {
fn test_get_merge_tool() {
let get = |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);
get_merge_tool_from_settings(&mut ui, &settings)
get_merge_tool_from_settings(&ui, &settings)
};
// Default