Update to Rust 1.70

This commit is contained in:
Alexis Sellier 2023-06-02 14:40:44 +02:00
parent fd91cf4d28
commit 4652f309b4
No known key found for this signature in database
15 changed files with 17 additions and 38 deletions

1
Cargo.lock generated
View File

@ -2164,7 +2164,6 @@ dependencies = [
"anstyle-query",
"anyhow",
"inquire",
"is-terminal",
"libc",
"once_cell",
"pretty_assertions",

View File

@ -48,7 +48,7 @@ impl Metadata {
let yaml = serde_yaml::to_string(&self)?;
match term::Editor::new().edit(yaml)? {
Some(meta) => Ok(serde_yaml::from_str(&meta).context("failed to parse proposal meta")?),
None => return Err(anyhow!("Operation aborted!")),
None => Err(anyhow!("Operation aborted!")),
}
}
}

View File

@ -55,7 +55,7 @@ where
A: Args,
C: Command<A, fn() -> anyhow::Result<Profile>>,
{
let args = std::env::args_os().into_iter().skip(1).collect();
let args = std::env::args_os().skip(1).collect();
run_command_args(help, action, cmd, args)
}

View File

@ -33,7 +33,7 @@ pub struct Help {
pub trait Args: Sized {
fn from_env() -> anyhow::Result<Self> {
let args: Vec<_> = std::env::args_os().into_iter().skip(1).collect();
let args: Vec<_> = std::env::args_os().skip(1).collect();
match Self::from_args(args) {
Ok((opts, unparsed)) => {

View File

@ -1,4 +1,5 @@
use std::io;
use std::io::IsTerminal as _;
use radicle::git;
@ -21,7 +22,7 @@ impl Message {
pub fn get(self, help: &str) -> std::io::Result<String> {
let comment = match self {
Message::Edit => {
if term::is_terminal(&io::stderr()) {
if io::stderr().is_terminal() {
term::Editor::new().extension("markdown").edit(help)?
} else {
Some(help.to_owned())

View File

@ -533,7 +533,7 @@ mod test {
.unwrap();
}
let mut actual = cache.entries().unwrap().into_iter().collect::<Vec<_>>();
let mut actual = cache.entries().unwrap().collect::<Vec<_>>();
actual.sort_by_key(|(i, _)| *i);
expected.sort_by_key(|(i, _)| *i);

View File

@ -8,7 +8,6 @@ edition = "2021"
[dependencies]
anyhow = { version = "1" }
anstyle-query = { version = "1.0.0" }
is-terminal = { version = "0.4.4" }
inquire = { version = "0.6", default-features = false, features = ["termion", "editor"] }
libc = { version = "0.2" }
once_cell = { version = "1.13" }

View File

@ -1,8 +1,8 @@
use std::io::IsTerminal as _;
use std::sync;
use std::sync::atomic::AtomicBool;
use std::{fmt, io};
use is_terminal::IsTerminal;
use unicode_width::UnicodeWidthStr;
use super::color::Color;

View File

@ -20,25 +20,19 @@ pub use element::{Element, Line, Max, Size};
pub use hstack::HStack;
pub use inquire::ui::Styled;
pub use io::*;
pub use is_terminal::is_terminal;
pub use label::{label, Label};
pub use spinner::{spinner, spinner_to, Spinner};
pub use table::Table;
pub use textarea::{textarea, TextArea};
pub use vstack::{VStack, VStackOptions};
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[derive(Debug, PartialEq, Eq, Copy, Clone, Default)]
pub enum Interactive {
Yes,
#[default]
No,
}
impl Default for Interactive {
fn default() -> Self {
Interactive::No
}
}
impl Interactive {
pub fn yes(&self) -> bool {
(*self).into()

View File

@ -121,10 +121,7 @@ impl ViewPage for HomeView {
fn subscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
app.subscribe(
&Cid::Home(HomeCid::Navigation),
Sub::new(
subscription::navigation_clause::<Cid, _>(),
SubClause::Always,
),
Sub::new(subscription::navigation_clause(), SubClause::Always),
)?;
Ok(())
@ -133,7 +130,7 @@ impl ViewPage for HomeView {
fn unsubscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
app.unsubscribe(
&Cid::Home(HomeCid::Navigation),
subscription::navigation_clause::<Cid, _>(),
subscription::navigation_clause(),
)?;
Ok(())
@ -199,10 +196,7 @@ impl ViewPage for IssuePage {
fn subscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
app.subscribe(
&Cid::Home(HomeCid::Navigation),
Sub::new(
subscription::navigation_clause::<Cid, _>(),
SubClause::Always,
),
Sub::new(subscription::navigation_clause(), SubClause::Always),
)?;
Ok(())
@ -211,7 +205,7 @@ impl ViewPage for IssuePage {
fn unsubscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
app.unsubscribe(
&Cid::Home(HomeCid::Navigation),
subscription::navigation_clause::<Cid, _>(),
subscription::navigation_clause(),
)?;
Ok(())
@ -287,10 +281,7 @@ impl ViewPage for PatchView {
fn subscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
app.subscribe(
&Cid::Patch(PatchCid::Navigation),
Sub::new(
subscription::navigation_clause::<Cid, _>(),
SubClause::Always,
),
Sub::new(subscription::navigation_clause(), SubClause::Always),
)?;
Ok(())
@ -299,7 +290,7 @@ impl ViewPage for PatchView {
fn unsubscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
app.unsubscribe(
&Cid::Patch(PatchCid::Navigation),
subscription::navigation_clause::<Cid, _>(),
subscription::navigation_clause(),
)?;
Ok(())

View File

@ -3,9 +3,8 @@ use std::hash::Hash;
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
use tuirealm::{Sub, SubClause, SubEventClause};
pub fn navigation_clause<Id, UserEvent>() -> SubEventClause<UserEvent>
pub fn navigation_clause<UserEvent>() -> SubEventClause<UserEvent>
where
Id: Clone + Hash + Eq + PartialEq,
UserEvent: Clone + Eq + PartialEq + PartialOrd,
{
SubEventClause::Keyboard(KeyEvent {

View File

@ -18,7 +18,6 @@ pub fn load_all(profile: &Profile, id: Id) -> Vec<(PatchId, Patch)> {
pub fn load_proposed(repository: &Repository) -> Result<Vec<(PatchId, Patch)>> {
let proposed = Patches::open(repository)?
.proposed()?
.into_iter()
.map(|(id, patch, _)| (id, patch))
.collect();

View File

@ -1231,7 +1231,6 @@ impl<'a> Patches<'a> {
let result = self
.all()?
.into_iter()
.filter_map(|result| result.ok())
.find_map(|(p_id, p, _)| p.revision(id).map(|r| (p_id, p.clone(), r.clone())));
Ok(result)

View File

@ -474,14 +474,12 @@ mod tests {
copy.find_remote(&REMOTE_NAME)
.unwrap()
.refspecs()
.into_iter()
.map(|r| r.bytes().to_vec())
.collect::<Vec<_>>(),
original
.find_remote(&REMOTE_NAME)
.unwrap()
.refspecs()
.into_iter()
.map(|r| r.bytes().to_vec())
.collect::<Vec<_>>(),
);

View File

@ -1 +1 @@
1.67
1.70