Bump rustyline (#1644)

* Bump rustyline

* Fix new clippy warnings

* Add pipeline command
This commit is contained in:
Jonathan Turner 2020-04-24 08:00:49 +12:00 committed by GitHub
parent 9e8434326d
commit d7bd77829f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 52 additions and 60 deletions

View file

@ -37,6 +37,8 @@ steps:
fi fi
if [ "$(uname)" == "Darwin" ]; then if [ "$(uname)" == "Darwin" ]; then
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain "stable" curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain "stable"
echo "Installing clippy"
rustup component add clippy --toolchain stable-x86_64-apple-darwin
export PATH=$HOME/.cargo/bin:$PATH export PATH=$HOME/.cargo/bin:$PATH
fi fi
rustup update rustup update

5
Cargo.lock generated
View file

@ -3175,9 +3175,9 @@ dependencies = [
[[package]] [[package]]
name = "rustyline" name = "rustyline"
version = "6.1.1" version = "6.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61a7384a84da856bd163ef2c22982c816b0bcedaf17978ec13d8e0e277ddc332" checksum = "1cd20b28d972040c627e209eb29f19c24a71a19d661cc5a220089176e20ee202"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"dirs 2.0.2", "dirs 2.0.2",
@ -3185,6 +3185,7 @@ dependencies = [
"log", "log",
"memchr", "memchr",
"nix 0.17.0", "nix 0.17.0",
"scopeguard",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
"utf8parse 0.2.0", "utf8parse 0.2.0",

View file

@ -64,7 +64,7 @@ query_interface = "0.3.5"
rand = "0.7" rand = "0.7"
regex = "1" regex = "1"
roxmltree = "0.10.1" roxmltree = "0.10.1"
rustyline = "6.1.1" rustyline = "6.1.2"
serde = { version = "1.0.106", features = ["derive"] } serde = { version = "1.0.106", features = ["derive"] }
serde-hjson = "0.9.1" serde-hjson = "0.9.1"
serde_bytes = "0.11.3" serde_bytes = "0.11.3"

View file

@ -110,8 +110,6 @@ pub fn compare_values(
left: &UntaggedValue, left: &UntaggedValue,
right: &UntaggedValue, right: &UntaggedValue,
) -> Result<bool, (&'static str, &'static str)> { ) -> Result<bool, (&'static str, &'static str)> {
match operator {
_ => {
let coerced = coerce_compare(left, right)?; let coerced = coerce_compare(left, right)?;
let ordering = coerced.compare(); let ordering = coerced.compare();
@ -119,9 +117,7 @@ pub fn compare_values(
let result = match (operator, ordering) { let result = match (operator, ordering) {
(Operator::Equal, Ordering::Equal) => true, (Operator::Equal, Ordering::Equal) => true,
(Operator::NotEqual, Ordering::Less) | (Operator::NotEqual, Ordering::Greater) => { (Operator::NotEqual, Ordering::Less) | (Operator::NotEqual, Ordering::Greater) => true,
true
}
(Operator::LessThan, Ordering::Less) => true, (Operator::LessThan, Ordering::Less) => true,
(Operator::GreaterThan, Ordering::Greater) => true, (Operator::GreaterThan, Ordering::Greater) => true,
(Operator::GreaterThanOrEqual, Ordering::Greater) (Operator::GreaterThanOrEqual, Ordering::Greater)
@ -132,8 +128,6 @@ pub fn compare_values(
}; };
Ok(result) Ok(result)
}
}
} }
pub fn format_type<'a>(value: impl Into<&'a UntaggedValue>, width: usize) -> String { pub fn format_type<'a>(value: impl Into<&'a UntaggedValue>, width: usize) -> String {

View file

@ -204,14 +204,11 @@ impl Shell for HelpShell {
let mut possible_completion = vec![]; let mut possible_completion = vec![];
let commands = self.commands(); let commands = self.commands();
for cmd in commands { for cmd in commands {
match cmd { let Value { value, .. } = cmd;
Value { value, .. } => {
for desc in value.data_descriptors() { for desc in value.data_descriptors() {
possible_completion.push(desc); possible_completion.push(desc);
} }
} }
}
}
let line_chars: Vec<_> = line.chars().collect(); let line_chars: Vec<_> = line.chars().collect();
let mut replace_pos = pos; let mut replace_pos = pos;

View file

@ -238,14 +238,11 @@ impl Shell for ValueShell {
let mut possible_completion = vec![]; let mut possible_completion = vec![];
let members = self.members(); let members = self.members();
for member in members { for member in members {
match member { let Value { value, .. } = member;
Value { value, .. } => {
for desc in value.data_descriptors() { for desc in value.data_descriptors() {
possible_completion.push(desc); possible_completion.push(desc);
} }
} }
}
}
let line_chars: Vec<_> = line.chars().collect(); let line_chars: Vec<_> = line.chars().collect();
let mut replace_pos = pos; let mut replace_pos = pos;

View file

@ -152,15 +152,16 @@ impl ExternalCommand {
SpannedExpression { SpannedExpression {
expr: Expression::Path(path), expr: Expression::Path(path),
.. ..
} => match &**path { } => {
Path { head, .. } => match head { let Path { head, .. } = &**path;
match head {
SpannedExpression { SpannedExpression {
expr: Expression::Variable(Variable::It(_)), expr: Expression::Variable(Variable::It(_)),
.. ..
} => true, } => true,
_ => false, _ => false,
}, }
}, }
_ => false, _ => false,
}) })
} }

View file

@ -21,17 +21,16 @@ impl Fetch {
} }
pub fn setup(&mut self, call_info: CallInfo) -> ReturnValue { pub fn setup(&mut self, call_info: CallInfo) -> ReturnValue {
self.path = Some( self.path = Some({
match call_info.args.nth(0).ok_or_else(|| { let file = call_info.args.nth(0).ok_or_else(|| {
ShellError::labeled_error( ShellError::labeled_error(
"No file or directory specified", "No file or directory specified",
"for command", "for command",
&call_info.name_tag, &call_info.name_tag,
) )
})? { })?;
file => file.clone(), file.clone()
}, });
);
self.has_raw = call_info.args.has("raw"); self.has_raw = call_info.args.has("raw");

View file

@ -42,24 +42,24 @@ impl Post {
} }
pub fn setup(&mut self, call_info: CallInfo) -> ReturnValue { pub fn setup(&mut self, call_info: CallInfo) -> ReturnValue {
self.path = Some( self.path = Some({
match call_info.args.nth(0).ok_or_else(|| { let file = call_info.args.nth(0).ok_or_else(|| {
ShellError::labeled_error( ShellError::labeled_error(
"No file or directory specified", "No file or directory specified",
"for command", "for command",
&call_info.name_tag, &call_info.name_tag,
) )
})? { })?;
file => file.clone(), file.clone()
}, });
);
self.has_raw = call_info.args.has("raw"); self.has_raw = call_info.args.has("raw");
self.body = match call_info.args.nth(1).ok_or_else(|| { self.body = {
let file = call_info.args.nth(1).ok_or_else(|| {
ShellError::labeled_error("No body specified", "for command", &call_info.name_tag) ShellError::labeled_error("No body specified", "for command", &call_info.name_tag)
})? { })?;
file => Some(file.clone()), Some(file.clone())
}; };
self.user = match call_info.args.get("user") { self.user = match call_info.args.get("user") {

View file

@ -68,12 +68,13 @@ impl Str {
} }
} }
}, },
Some(Action::ToInteger) => match input.trim() { Some(Action::ToInteger) => {
other => match other.parse::<i64>() { let other = input.trim();
match other.parse::<i64>() {
Ok(v) => UntaggedValue::int(v), Ok(v) => UntaggedValue::int(v),
Err(_) => UntaggedValue::string(input), Err(_) => UntaggedValue::string(input),
}, }
}, }
Some(Action::ToDateTime(dt)) => match DateTime::parse_from_str(input, dt) { Some(Action::ToDateTime(dt)) => match DateTime::parse_from_str(input, dt) {
Ok(d) => UntaggedValue::date(d), Ok(d) => UntaggedValue::date(d),
Err(_) => UntaggedValue::string(input), Err(_) => UntaggedValue::string(input),