Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit 1cdd4df

Browse files
committed
Update the version of Rust
- Upgrade to Rust `1.58.0` - Update code to align with the newer coding conventions. - Clean up linting and compiler warnings. - Pin `pip<21.0` and `setuptools<=50.3.2` in `libindy/ci/ubuntu.dockerfile` to resolve build/test issues on ubuntu 16.04. Signed-off-by: Wade Barnes <[email protected]>
1 parent 113b79c commit 1cdd4df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+35
-201
lines changed

Jenkinsfile.cd

+2-2
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def iosTesting() {
595595
//FIXME We downgrade rust for iOS build as 1.46.0 forces building cdylib crate that causes linking errors.
596596
//FIXME See https://github.com/rust-lang/rust/issues/79373 for details.
597597
//FIXME It is fixed in nightly already and we will switch to 1.49 after it is released.
598-
sh "rustup default 1.45.0"
598+
sh "rustup default 1.58.0"
599599

600600
setupRustIOS()
601601
setupBrewPackages()
@@ -1456,7 +1456,7 @@ def shell(command) {
14561456
}
14571457

14581458
def setupRust() {
1459-
shell("rustup default 1.46.0")
1459+
shell("rustup default 1.58.0")
14601460
}
14611461

14621462
def androidPublishing() {

Jenkinsfile.ci

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def iosTesting() {
264264
//FIXME We downgrade rust for iOS build as 1.46.0 forces building cdylib crate that causes linking errors.
265265
//FIXME See https://github.com/rust-lang/rust/issues/79373 for details.
266266
//FIXME It is fixed in nightly already and we will switch to 1.49 after it is released.
267-
sh "rustup default 1.45.0"
267+
sh "rustup default 1.58.0"
268268

269269
setupRustIOS()
270270
setupBrewPackages()
@@ -666,7 +666,7 @@ def shell(command) {
666666
}
667667

668668
def setupRust() {
669-
shell("rustup default 1.46.0")
669+
shell("rustup default 1.58.0")
670670
}
671671

672672
def setupBrewPackages() {

ci/ga-ios-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if [ -z "${LIBINDY_POD_VERSION}" ]; then
1717
fi
1818

1919
if [ -z "${RUST_VER}" ]; then
20-
export RUST_VER=1.45.2
20+
export RUST_VER=1.58.0
2121
echo "ERROR: RUST_VER environment variable not specified, using $RUST_VER"
2222
fi
2323

cli/src/command_executor.rs

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ impl ParamMetadata {
5151
}
5252
}
5353

54+
// Turn off "error: field is never read: `dynamic_completion_type`" warning
55+
#[allow(dead_code)]
5456
#[derive(Debug)]
5557
pub struct CommandMetadata {
5658
name: &'static str,

cli/src/utils/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ macro_rules! unwrap_or_return {
5959
match $result {
6060
Some(res) => res,
6161
None => return $err
62-
};
62+
}
6363
}
6464
}

libindy/ci/alpine.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM alpine:3.12
22

33
ARG UID=1000
44
ARG GID=1000
5-
ARG RUST_VER="1.45.2"
5+
ARG RUST_VER="1.58.0"
66
ARG INDYSDK_PATH=/home/indy/indy-sdk
77

88
ENV RUST_LOG=warning

libindy/ci/centos.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ RUN wget https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-mav
3939
RUN sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
4040
RUN yum install -y apache-maven
4141

42-
ENV RUST_ARCHIVE=rust-1.46.0-x86_64-unknown-linux-gnu.tar.gz
42+
ENV RUST_ARCHIVE=rust-1.58.0-x86_64-unknown-linux-gnu.tar.gz
4343
ENV RUST_DOWNLOAD_URL=https://static.rust-lang.org/dist/$RUST_ARCHIVE
4444

4545
RUN mkdir -p /rust

libindy/ci/ubuntu.dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
3131
RUN apt-get install -y nodejs
3232

3333
RUN pip3 install -U \
34-
pip \
35-
setuptools \
34+
'pip<21.0' \
35+
'setuptools<=50.3.2' \
3636
virtualenv \
3737
twine==1.15.0 \
3838
plumbum==1.6.7 six==1.12.0 \
@@ -62,7 +62,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6262
RUN useradd -ms /bin/bash -u $uid indy
6363
USER indy
6464

65-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.46.0
65+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.58.0
6666
ENV PATH /home/indy/.cargo/bin:$PATH
6767

6868
RUN cargo install cargo-deb

libindy/ci/ubuntu18.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN apt-get install -y wget
4545
RUN useradd -ms /bin/bash -u $uid indy
4646
USER indy
4747

48-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.46.0
48+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.58.0
4949
ENV PATH /home/indy/.cargo/bin:$PATH
5050

5151
RUN cargo install cargo-deb

libindy/ci/wrappers/wrapper-base.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:18.04
22

3-
ARG RUST_VER=1.46.0
3+
ARG RUST_VER=1.58.0
44

55
RUN apt-get update && \
66
apt-get install -y \

libindy/indy-api-types/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl fmt::Display for IndyError {
137137
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
138138
let mut first = true;
139139

140-
for cause in Fail::iter_chain(self.inner.as_ref()) {
140+
for cause in <dyn Fail>::iter_chain(self.inner.as_ref()) {
141141
if first {
142142
first = false;
143143
writeln!(f, "Error: {}", cause)?;
@@ -225,7 +225,7 @@ impl From<log::SetLoggerError> for IndyError {
225225
#[cfg(feature = "casting_errors")]
226226
impl From<UrsaCryptoError> for IndyError {
227227
fn from(err: UrsaCryptoError) -> Self {
228-
let message = format!("UrsaCryptoError: {}", Fail::iter_causes(&err).map(|e| e.to_string()).collect::<String>());
228+
let message = format!("UrsaCryptoError: {}", <dyn Fail>::iter_causes(&err).map(|e| e.to_string()).collect::<String>());
229229

230230
match err.kind() {
231231
UrsaCryptoErrorKind::InvalidState => IndyError::from_msg(IndyErrorKind::InvalidState, message),

libindy/src/commands/non_secrets.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ impl NonSecretsCommandExecutor {
312312
}
313313
}
314314

315-
#[serde(rename_all = "camelCase")]
316315
#[derive(Debug, Deserialize, Serialize)]
316+
#[serde(rename_all = "camelCase")]
317317
pub struct SearchRecords {
318318
pub total_count: Option<usize>,
319319
pub records: Option<Vec<WalletRecord>>

libindy/src/domain/cache.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#[serde(rename_all = "camelCase")]
21
#[derive(Debug, Deserialize, Serialize)]
2+
#[serde(rename_all = "camelCase")]
33
pub struct PurgeOptions {
44
pub max_age: Option<i32>,
55
}
66

7-
#[serde(rename_all = "camelCase")]
87
#[derive(Debug, Deserialize, Serialize, Clone)]
8+
#[serde(rename_all = "camelCase")]
99
pub struct GetCacheOptions {
1010
pub no_cache: Option<bool>, // Skip usage of cache,
1111
pub no_update: Option<bool>, // Use only cached data, do not try to update.

libindy/src/domain/ledger/response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pub struct TxnMetadata {
6060
pub creation_time: u64,
6161
}
6262

63-
#[serde(tag = "op")]
6463
#[derive(Deserialize, Debug)]
64+
#[serde(tag = "op")]
6565
pub enum Message<T> {
6666
#[serde(rename = "REQNACK")]
6767
ReqNACK(Response),

libindy/src/services/pool/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ pub struct SimpleRequest {
354354
pub req_id: u64,
355355
}
356356

357-
#[serde(tag = "op")]
358357
#[derive(Serialize, Deserialize, Debug)]
358+
#[serde(tag = "op")]
359359
pub enum Message {
360360
#[serde(rename = "CONSISTENCY_PROOF")]
361361
ConsistencyProof(ConsistencyProof),

libindy/src/utils/result.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ macro_rules! unwrap_opt_or_return {
6161
match $opt {
6262
Some(val) => val,
6363
None => return $err
64-
};
64+
}
6565
}
6666
}
6767

@@ -70,6 +70,6 @@ macro_rules! unwrap_or_return {
7070
match $result {
7171
Ok(res) => res,
7272
Err(_) => return $err
73-
};
73+
}
7474
}
7575
}

libindy/tests/utils/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ pub struct WalletRecord {
7777
pub tags: Option<HashMap<String, String>>
7878
}
7979

80-
#[serde(rename_all = "camelCase")]
8180
#[derive(Debug, Deserialize, Serialize)]
81+
#[serde(rename_all = "camelCase")]
8282
pub struct SearchRecords {
8383
pub total_count: Option<i32>,
8484
pub records: Option<Vec<WalletRecord>>

libnullpay/src/libindy/ledger.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub fn build_get_txn_request(
2828

2929

3030
extern {
31-
#[no_mangle]
3231
pub fn indy_build_get_txn_request(command_handle: i32,
3332
submitter_did: *const c_char,
3433
ledger_type: *const c_char,

libnullpay/src/libindy/logger.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@ pub fn get_logger() -> Result<(*const c_void, Option<EnabledCB>, Option<LogCB>,
3535
}
3636

3737
extern {
38-
#[no_mangle]
3938
pub fn indy_get_logger(context: *mut *const c_void, enabled_cb_p: *mut Option<EnabledCB>, log_cb_p: *mut Option<LogCB>, flush_cb_p: *mut Option<FlushCB>) -> ErrorCode;
4039
}

libnullpay/src/libindy/payments.rs

-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ pub fn list_payment_addresses(wallet_handle: i32,
161161
}
162162

163163
extern {
164-
#[no_mangle]
165164
pub fn indy_register_payment_method(
166165
command_handle: i32,
167166
payment_method: *const c_char,
@@ -182,7 +181,6 @@ extern {
182181
verify_with_address: Option<VerifyWithAddressCB>,
183182
cb: Option<extern fn(command_handle_: i32, err: ErrorCode)>) -> ErrorCode;
184183

185-
#[no_mangle]
186184
fn indy_list_payment_addresses(command_handle: i32,
187185
wallet_handle: i32,
188186
cb: Option<extern fn(command_handle_: i32,

vcx/ci/test.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ RUN curl -fsOSL $LIBINDY_DOWNLOAD_URL \
4747
&& apt-get -f install
4848

4949
# Install Rust
50-
ENV RUST_ARCHIVE=rust-1.20.0-x86_64-unknown-linux-gnu.tar.gz
50+
ENV RUST_ARCHIVE=rust-1.58.0-x86_64-unknown-linux-gnu.tar.gz
5151
ENV RUST_DOWNLOAD_URL=https://static.rust-lang.org/dist/$RUST_ARCHIVE
5252

5353
RUN mkdir -p /rust

vcx/ci/ubuntu.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ARG uid=1000
6060
RUN useradd -ms /bin/bash -u $uid vcx
6161
USER vcx
6262

63-
ARG RUST_VER="1.46.0"
63+
ARG RUST_VER="1.58.0"
6464
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_VER
6565
ENV PATH /home/vcx/.cargo/bin:$PATH
6666

vcx/dummy-cloud-agent/src/domain/a2a.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ pub struct SendMessages {
208208
pub uids: Vec<String>,
209209
}
210210

211-
#[serde(untagged)]
212211
#[derive(Debug, Deserialize, Serialize)]
212+
#[serde(untagged)]
213213
pub enum MessageDetail {
214214
ConnectionRequestRedirect(ConnectionRequestRedirectMessageDetail),
215215
ConnectionRequestAnswer(ConnectionRequestAnswerMessageDetail),

vcx/libvcx/build_scripts/ios/mac/mac.01.libindy.setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fi
4444

4545
if [[ $RUSTUP_VERSION =~ ^'rustup ' ]]; then
4646
rustup update
47-
rustup default 1.46.0
47+
rustup default 1.58.0
4848
rustup component add rls-preview rust-analysis rust-src
4949
echo "Using rustc version $(rustc --version)"
5050
rustup target add aarch64-apple-ios x86_64-apple-ios

vcx/libvcx/src/error/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl fmt::Display for VcxError {
234234
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
235235
let mut first = true;
236236

237-
for cause in Fail::iter_chain(&self.inner) {
237+
for cause in dyn Fail::iter_chain(&self.inner) {
238238
if first {
239239
first = false;
240240
writeln!(f, "Error: {}", cause)?;
@@ -426,7 +426,7 @@ pub fn set_current_error(err: &VcxError) {
426426
let error_json = json!({
427427
"error": err.kind().to_string(),
428428
"message": err.to_string(),
429-
"cause": Fail::find_root_cause(err).to_string(),
429+
"cause": dyn Fail::find_root_cause(err).to_string(),
430430
"backtrace": err.backtrace().map(|bt| bt.to_string())
431431
}).to_string();
432432
error.replace(Some(CStringUtils::string_to_cstring(error_json)));

vcx/libvcx/src/messages/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ pub struct MessageSent {
551551
pub uids: Vec<String>,
552552
}
553553

554-
#[serde(untagged)]
555554
#[derive(Debug, Deserialize, Serialize)]
555+
#[serde(untagged)]
556556
pub enum MessageDetail {
557557
ConnectionRequestAnswer(AcceptInviteMessageDetails),
558558
ConnectionRequestRedirect(RedirectConnectionMessageDetails),

vcx/libvcx/src/utils/libindy/ledger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ pub struct Request {
485485
pub endorser: Option<String>
486486
}
487487

488-
#[serde(tag = "op")]
489488
#[derive(Deserialize, Debug)]
489+
#[serde(tag = "op")]
490490
pub enum Response {
491491
#[serde(rename = "REQNACK")]
492492
ReqNACK(Reject),

wrappers/rust/indy-sys/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ fn find_dir(dir_name: Option<String>, use_static: bool) {
4848
fn find_pkg(use_static: bool) {
4949
match pkg_config::Config::new().statik(use_static).probe("libindy") {
5050
Ok(_) => println!("cargo:warning=Libindy found in pkgcfg tree."),
51-
Err(e) => panic!(format!("Error: {:?}", e)),
51+
Err(e) => panic!("Error: {:?}", e),
5252
}
5353
}
5454

5555
#[cfg(target_env = "msvc")]
5656
fn find_pkg(_use_static: bool) {
5757
match vcpkg::Config::new().emit_includes(true).lib_name("libindy").probe("indy") {
5858
Ok(_) => println!("cargo:warning=Libindy found in vcpkg tree."),
59-
Err(e) => panic!(format!("Error: {:?}", e)),
59+
Err(e) => panic!("Error: {:?}", e),
6060
}
6161
}

0 commit comments

Comments
 (0)