Skip to content

Commit 5c932ef

Browse files
authored
proto: try to fix CI (#565)
Signed-off-by: lance6716 <lance6716@gmail.com>
1 parent 0d01b20 commit 5c932ef

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

proto/src/confchange.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub trait ConfChangeI {
7171
fn into_v2(self) -> ConfChangeV2;
7272

7373
/// Gets conf change as `ConfChangeV2`.
74-
fn as_v2(&self) -> Cow<ConfChangeV2>;
74+
fn as_v2(&self) -> Cow<'_, ConfChangeV2>;
7575

7676
/// Converts conf change to `ConfChange`.
7777
///
@@ -90,7 +90,7 @@ impl ConfChangeI for ConfChange {
9090
}
9191

9292
#[inline]
93-
fn as_v2(&self) -> Cow<ConfChangeV2> {
93+
fn as_v2(&self) -> Cow<'_, ConfChangeV2> {
9494
Cow::Owned(self.clone().into_v2())
9595
}
9696

@@ -107,7 +107,7 @@ impl ConfChangeI for ConfChangeV2 {
107107
}
108108

109109
#[inline]
110-
fn as_v2(&self) -> Cow<ConfChangeV2> {
110+
fn as_v2(&self) -> Cow<'_, ConfChangeV2> {
111111
Cow::Borrowed(self)
112112
}
113113

proto/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// We use `default` method a lot to be support prost and rust-protobuf at the
44
// same time. And reassignment can be optimized by compiler.
55
#![allow(clippy::field_reassign_with_default)]
6+
#![allow(mismatched_lifetime_syntaxes)]
7+
#![allow(unused_parens)]
68

79
mod confchange;
810
mod confstate;

src/confchange/changer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct Changer<'a> {
4545

4646
impl Changer<'_> {
4747
/// Creates a changer.
48-
pub fn new(tracker: &ProgressTracker) -> Changer {
48+
pub fn new(tracker: &ProgressTracker) -> Changer<'_> {
4949
Changer { tracker }
5050
}
5151

@@ -271,7 +271,7 @@ impl Changer<'_> {
271271
///
272272
/// Unlike Etcd, we don't copy progress as we don't need to mutate the `is_learner`
273273
/// flags. Additions and Removals should be done after everything is checked OK.
274-
fn check_and_copy(&self) -> Result<(Configuration, IncrChangeMap)> {
274+
fn check_and_copy(&self) -> Result<(Configuration, IncrChangeMap<'_>)> {
275275
let prs = IncrChangeMap {
276276
changes: vec![],
277277
base: self.tracker.progress(),

src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ mod tests {
144144
Error::ConfigInvalid(String::from("other error"))
145145
);
146146
assert_eq!(
147-
Error::from(io::Error::new(io::ErrorKind::Other, "oh no!")),
148-
Error::from(io::Error::new(io::ErrorKind::Other, "oh yes!"))
147+
Error::from(io::Error::other("oh no!")),
148+
Error::from(io::Error::other("oh yes!"))
149149
);
150150
assert_ne!(
151151
Error::StepPeerNotFound,

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@ by one:
301301
}
302302
```
303303
304-
Note, although Raft guarentees only persisted committed entries will be applied,
305-
but it doesn't guarentee commit index is persisted before being applied. For example,
306-
if application is restarted after applying committed entries before persisting
307-
commit index, apply index can be larger than commit index and cause panic. To
308-
solve the problem, persisting commit index with or before applying entries.
309-
You can also always assign commit index to the `max(commit_index, applied_index)`
310-
after restarting, *it may work but potential log loss may also be ignored silently*.
304+
Note, although Raft guarentees only persisted committed entries will be applied,
305+
but it doesn't guarentee commit index is persisted before being applied. For example,
306+
if application is restarted after applying committed entries before persisting
307+
commit index, apply index can be larger than commit index and cause panic. To
308+
solve the problem, persisting commit index with or before applying entries.
309+
You can also always assign commit index to the `max(commit_index, applied_index)`
310+
after restarting, *it may work but potential log loss may also be ignored silently*.
311311
312312
4. Check whether `entries` is empty or not. If not empty, it means that there are newly added
313313
entries but have not been committed yet, we must append the entries to the Raft log:
@@ -425,7 +425,7 @@ above except:
425425
1. All writes are not required to be persisted immediately, they can be written into memory caches;
426426
2. Persisted messages should be sent after all corresponding writes are persisted;
427427
3. [`advance_append_async`](RawNode::advance_append_async) is used when all writes are finished
428-
instead of `advance/advance_append`.
428+
instead of `advance/advance_append`.
429429
4. Only persisted entries can be committed and applied, so to make progress, all writes should
430430
be persisted at some point.
431431
@@ -585,7 +585,7 @@ pub fn default_logger() -> slog::Logger {
585585

586586
if let Some(case) = std::thread::current()
587587
.name()
588-
.and_then(|v| v.split(':').last())
588+
.and_then(|v| v.split(':').next_back())
589589
{
590590
logger.new(o!("case" => case.to_string()))
591591
} else {

src/raw_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ impl<T: Storage> RawNode<T> {
718718

719719
/// Status returns the current status of the given group.
720720
#[inline]
721-
pub fn status(&self) -> Status {
721+
pub fn status(&self) -> Status<'_> {
722722
Status::new(&self.raft)
723723
}
724724

0 commit comments

Comments
 (0)