Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to build with rust 1.80 #134

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
931 changes: 487 additions & 444 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn commit_info() -> String {
fn commit_hash() -> Result<String, Ignore> {
Ok(String::from_utf8(
Command::new("git")
.args(&["rev-parse", "--short=9", "HEAD"])
.args(["rev-parse", "--short=9", "HEAD"])
.output()?
.stdout,
)?)
Expand All @@ -47,7 +47,7 @@ fn commit_hash() -> Result<String, Ignore> {
fn commit_date() -> Result<String, Ignore> {
Ok(String::from_utf8(
Command::new("git")
.args(&["log", "-1", "--date=short", "--pretty=format:%cd"])
.args(["log", "-1", "--date=short", "--pretty=format:%cd"])
.output()?
.stdout,
)?)
Expand Down
13 changes: 5 additions & 8 deletions src/download/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ pub fn download_to_path_with_backend(

|| -> Result<()> {
let file = OpenOptions::new()
.write(true)
.create(true)
.open(&path)
.chain_err(|| "error creating file for download")?;
.write(true)
.create(true)
.open(&path)
.chain_err(|| "error creating file for download")?;

let file = RefCell::new(file);

Expand Down Expand Up @@ -93,10 +93,7 @@ pub mod curl {

thread_local!(pub static EASY: RefCell<Easy> = RefCell::new(Easy::new()));

pub fn download(
url: &Url,
callback: &dyn Fn(Event) -> Result<()>,
) -> Result<()> {
pub fn download(url: &Url, callback: &dyn Fn(Event) -> Result<()>) -> Result<()> {
// Fetch either a cached libcurl handle (which will preserve open
// connections) or create a new one if it isn't listed.
//
Expand Down
24 changes: 10 additions & 14 deletions src/elan-cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn confirm(question: &str, default: bool) -> Result<bool> {
_ => false,
};

println!("");
println!();

Ok(r)
}
Expand All @@ -38,7 +38,7 @@ pub enum Confirm {
}

pub fn confirm_advanced() -> Result<Confirm> {
println!("");
println!();
println!("1) Proceed with installation (default)");
println!("2) Customize installation");
println!("3) Cancel installation");
Expand All @@ -52,7 +52,7 @@ pub fn confirm_advanced() -> Result<Confirm> {
_ => Confirm::No,
};

println!("");
println!();

Ok(r)
}
Expand All @@ -62,7 +62,7 @@ pub fn question_str(question: &str, default: &str) -> Result<String> {
let _ = std::io::stdout().flush();
let input = read_line()?;

println!("");
println!();

if input.is_empty() {
Ok(default.to_string())
Expand All @@ -77,7 +77,7 @@ pub fn question_bool(question: &str, default: bool) -> Result<bool> {
let _ = std::io::stdout().flush();
let input = read_line()?;

println!("");
println!();

if input.is_empty() {
Ok(default)
Expand Down Expand Up @@ -130,11 +130,8 @@ pub fn set_globals(verbose: bool) -> Result<Cfg> {
}))?)
}

pub fn show_channel_update(
cfg: &Cfg,
desc: &ToolchainDesc,
) -> Result<()> {
let ref toolchain = cfg.get_toolchain(&desc, false).expect("");
pub fn show_channel_update(cfg: &Cfg, desc: &ToolchainDesc) -> Result<()> {
let toolchain = &cfg.get_toolchain(desc, false).expect("");
let version = lean_version(toolchain);
let name = desc.to_string();

Expand All @@ -151,7 +148,7 @@ pub fn show_channel_update(
let _ = write!(t, "{}", banner);
let _ = t.reset();
let _ = writeln!(t, " - {}", version);
let _ = writeln!(t, "");
let _ = writeln!(t);

Ok(())
}
Expand Down Expand Up @@ -226,7 +223,7 @@ pub fn list_overrides(cfg: &Cfg) -> Result<()> {
)
}
if any_not_exist {
println!("");
println!();
info!(
"you may remove overrides for non-existent directories with
`elan override unset --nonexistent`"
Expand All @@ -253,10 +250,9 @@ pub fn report_error(e: &Error) {
if show_backtrace() {
if let Some(backtrace) = e.backtrace() {
info!("backtrace:");
println!("");
println!();
println!("{:?}", backtrace);
}
} else {
}

fn show_backtrace() -> bool {
Expand Down
14 changes: 3 additions & 11 deletions src/elan-cli/download_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl DownloadTracker {
if self.displayed_charcount.is_some() {
// Display the finished state
self.display();
let _ = writeln!(self.term.as_mut().unwrap(), "");
let _ = writeln!(self.term.as_mut().unwrap());
}
self.prepare_for_new_download();
}
Expand Down Expand Up @@ -159,19 +159,11 @@ impl DownloadTracker {
let eta_h = HumanReadable(remaining / speed);
format!(
"{} / {} ({:3.0} %) {}/s ETA: {:#}",
total_h,
content_len_h,
percent,
speed_h,
eta_h
total_h, content_len_h, percent, speed_h, eta_h
)
}
None => {
format!(
"Total: {} Speed: {}/s",
total_h,
speed_h
)
format!("Total: {} Speed: {}/s", total_h, speed_h)
}
};

Expand Down
Loading
Loading