Skip to content

Commit 92da4dd

Browse files
authored
Merge pull request #307 from danieleades/clippy/redundant-field-names
remove redundant field names
2 parents 479df3a + 631e81f commit 92da4dd

12 files changed

Lines changed: 64 additions & 68 deletions

File tree

‎async-byte-channel/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Drop for Receiver {
6262
pub fn channel() -> (Sender, Receiver) {
6363
let inner = Arc::new(Mutex::new(Inner::new()));
6464
let sender = Sender { inner: inner.clone() };
65-
let receiver = Receiver { inner: inner };
65+
let receiver = Receiver { inner };
6666
(sender, receiver)
6767
}
6868

‎capnp-futures/src/read_stream.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl <'a, R> ReadStream<'a, R> where R: AsyncRead + Unpin + 'a {
4747
{
4848
ReadStream {
4949
read: Box::pin(read_next_message(reader, options)),
50-
options: options,
50+
options,
5151
}
5252
}
5353
}

‎capnp-futures/src/serialize.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ pub mod test {
421421

422422
impl <R> BlockingRead<R> where R: Read {
423423
pub(crate) fn new(read: R, blocking_period: usize) -> BlockingRead<R> {
424-
BlockingRead { read: read, blocking_period, idx: 0 }
424+
BlockingRead { read, blocking_period, idx: 0 }
425425
}
426426
}
427427

@@ -457,7 +457,7 @@ pub mod test {
457457

458458
impl <W> BlockingWrite<W> where W: Write {
459459
pub(crate) fn new(writer: W, blocking_period: usize) -> BlockingWrite<W> {
460-
BlockingWrite { writer: writer, blocking_period, idx: 0 }
460+
BlockingWrite { writer, blocking_period, idx: 0 }
461461
}
462462
pub(crate) fn into_writer(self) -> W {
463463
self.writer

‎capnp-rpc/src/broken.rs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ pub struct Pipeline {
3535

3636
impl Pipeline {
3737
pub fn new(error: Error) -> Pipeline {
38-
Pipeline {
39-
error: error
40-
}
38+
Pipeline { error }
4139
}
4240
}
4341

@@ -59,7 +57,7 @@ pub struct Request {
5957
impl Request {
6058
pub fn new(error: Error, _size_hint: Option<::capnp::MessageSize>) -> Request {
6159
Request {
62-
error: error,
60+
error,
6361
message: ::capnp::message::Builder::new_default(),
6462
cap_table: Vec::new(),
6563
}
@@ -103,9 +101,9 @@ impl Client {
103101
pub fn new(error: Error, resolved: bool, brand: usize) -> Client {
104102
Client {
105103
inner: Rc::new(ClientInner {
106-
error: error,
104+
error,
107105
_resolved: resolved,
108-
brand: brand,
106+
brand,
109107
}),
110108
}
111109
}

‎capnp-rpc/src/lib.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ impl <VatId> RpcSystem <VatId> {
203203
}));
204204

205205
let mut result = RpcSystem {
206-
network: network,
207-
bootstrap_cap: bootstrap_cap,
206+
network,
207+
bootstrap_cap,
208208
connection_state: Rc::new(RefCell::new(None)),
209209

210-
tasks: tasks,
210+
tasks,
211211
handle: handle.clone(),
212212
};
213213

‎capnp-rpc/src/local.rs‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct Response {
5050
impl Response {
5151
fn new(results: Box<dyn ResultsDoneHook>) -> Response {
5252
Response {
53-
results: results
53+
results
5454
}
5555
}
5656
}
@@ -72,8 +72,8 @@ impl Params {
7272
-> Params
7373
{
7474
Params {
75-
request: request,
76-
cap_table: cap_table,
75+
request,
76+
cap_table,
7777
}
7878
}
7979
}
@@ -157,8 +157,8 @@ impl ResultsDone {
157157
{
158158
ResultsDone {
159159
inner: Rc::new(ResultsDoneInner {
160-
message: message,
161-
cap_table: cap_table,
160+
message,
161+
cap_table,
162162
}),
163163
}
164164
}
@@ -193,9 +193,9 @@ impl Request {
193193
Request {
194194
message: message::Builder::new_default(),
195195
cap_table: Vec::new(),
196-
interface_id: interface_id,
197-
method_id: method_id,
198-
client: client,
196+
interface_id,
197+
method_id,
198+
client,
199199
}
200200
}
201201
}
@@ -234,7 +234,7 @@ impl RequestHook for Request {
234234

235235
capability::RemotePromise {
236236
promise: Promise::from_future(left),
237-
pipeline: pipeline,
237+
pipeline,
238238
}
239239
}
240240
fn tail_send(self: Box<Self>)
@@ -255,7 +255,7 @@ pub struct Pipeline {
255255
impl Pipeline {
256256
pub fn new(results: Box<dyn ResultsDoneHook>) -> Pipeline {
257257
Pipeline {
258-
inner: Rc::new(RefCell::new(PipelineInner { results: results }))
258+
inner: Rc::new(RefCell::new(PipelineInner { results }))
259259
}
260260
}
261261
}

‎capnp-rpc/src/queued.rs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl Pipeline {
105105
}));
106106

107107

108-
(PipelineInnerSender { inner: Some(Rc::downgrade(&inner)) }, Pipeline { inner: inner })
108+
(PipelineInnerSender { inner: Some(Rc::downgrade(&inner)) }, Pipeline { inner })
109109
}
110110

111111
pub fn drive<F>(&mut self, promise: F)
@@ -201,14 +201,12 @@ impl Client {
201201
{
202202
let inner = Rc::new(RefCell::new(ClientInner {
203203
promise_to_drive: None,
204-
pipeline_inner: pipeline_inner,
204+
pipeline_inner,
205205
redirect: None,
206206
call_forwarding_queue: SenderQueue::new(),
207207
client_resolution_queue: SenderQueue::new(),
208208
}));
209-
Client {
210-
inner: inner
211-
}
209+
Client { inner }
212210
}
213211

214212
pub fn drive<F>(&mut self, promise: F)

‎capnp-rpc/src/rpc.rs‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl <VatId> QuestionRef<VatId> {
180180
fulfiller: oneshot::Sender<Promise<Response<VatId>, Error>>)
181181
-> QuestionRef<VatId>
182182
{
183-
QuestionRef { connection_state: state, id: id, fulfiller: Some(fulfiller) }
183+
QuestionRef { connection_state: state, id, fulfiller: Some(fulfiller) }
184184
}
185185
fn fulfill(&mut self, response: Promise<Response<VatId>, Error>) {
186186
if let Some(fulfiller) = self.fulfiller.take() {
@@ -281,7 +281,7 @@ impl Export {
281281
fn new(client_hook: Box<dyn ClientHook>) -> Export {
282282
Export {
283283
refcount: 1,
284-
client_hook: client_hook,
284+
client_hook,
285285
resolve_op: Promise::err(Error::failed("no resolve op".to_string())),
286286
}
287287
}
@@ -360,7 +360,7 @@ fn remote_exception_to_error(exception: exception::Reader) -> Error {
360360
(::capnp::ErrorKind::Unimplemented, reason),
361361
_ => (::capnp::ErrorKind::Failed, "(malformed error)"),
362362
};
363-
Error { description: format!("remote exception: {}", reason), kind: kind }
363+
Error { description: format!("remote exception: {}", reason), kind }
364364
}
365365

366366
pub struct ConnectionErrorHandler<VatId> where VatId: 'static {
@@ -369,7 +369,7 @@ pub struct ConnectionErrorHandler<VatId> where VatId: 'static {
369369

370370
impl <VatId> ConnectionErrorHandler<VatId> {
371371
fn new(weak_state: Weak<ConnectionState<VatId>>) -> ConnectionErrorHandler<VatId> {
372-
ConnectionErrorHandler { weak_state: weak_state }
372+
ConnectionErrorHandler { weak_state }
373373
}
374374
}
375375

@@ -407,7 +407,7 @@ impl <VatId> ConnectionState<VatId> {
407407
-> (TaskSet<Error>, Rc<ConnectionState<VatId>>)
408408
{
409409
let state = Rc::new(ConnectionState {
410-
bootstrap_cap: bootstrap_cap,
410+
bootstrap_cap,
411411
exports: RefCell::new(ExportTable::new()),
412412
questions: RefCell::new(ExportTable::new()),
413413
answers: RefCell::new(ImportTable::new()),
@@ -1495,8 +1495,8 @@ impl <VatId> Disconnector<VatId> {
14951495
}
14961496
};
14971497
Disconnector {
1498-
connection_state: connection_state,
1499-
state: state,
1498+
connection_state,
1499+
state,
15001500
}
15011501
}
15021502
fn disconnect(&self) {
@@ -1564,7 +1564,7 @@ impl <VatId> Response<VatId> {
15641564
Response {
15651565
variant: Rc::new(ResponseVariant::Rpc(ResponseState {
15661566
_connection_state: connection_state,
1567-
message: message,
1567+
message,
15681568
cap_table: cap_table_array,
15691569
_question_ref: question_ref,
15701570
})),
@@ -1638,9 +1638,9 @@ impl <VatId> Request<VatId> where VatId: 'static {
16381638

16391639
let message = connection_state.new_outgoing_message(100)?;
16401640
Ok(Request {
1641-
connection_state: connection_state,
1642-
target: target,
1643-
message: message,
1641+
connection_state,
1642+
target,
1643+
message,
16441644
cap_table: Vec::new(),
16451645
})
16461646
}
@@ -1879,7 +1879,7 @@ impl <VatId> Pipeline<VatId> {
18791879
}
18801880
None => {}
18811881
}
1882-
Pipeline { state: state }
1882+
Pipeline { state }
18831883
}
18841884

18851885
fn when_resolved(&self) -> Promise<(), Error> {
@@ -1892,14 +1892,14 @@ impl <VatId> Pipeline<VatId> {
18921892
{
18931893
let state = Rc::new(RefCell::new(PipelineState {
18941894
variant: PipelineVariant::Waiting(question_ref),
1895-
connection_state: connection_state,
1895+
connection_state,
18961896
redirect_later: None,
18971897
resolve_self_promise: Promise::from_future(future::pending()),
18981898
promise_clients_to_resolve: RefCell::new(crate::sender_queue::SenderQueue::new()),
18991899
resolution_waiters: crate::sender_queue::SenderQueue::new(),
19001900
}));
19011901

1902-
Pipeline { state: state }
1902+
Pipeline { state }
19031903
}
19041904
}
19051905

@@ -1957,8 +1957,8 @@ impl Params {
19571957
-> Params
19581958
{
19591959
Params {
1960-
request: request,
1961-
cap_table: cap_table,
1960+
request,
1961+
cap_table,
19621962
}
19631963
}
19641964
}
@@ -2040,9 +2040,9 @@ impl <VatId> Results<VatId> where VatId: 'static {
20402040
inner: Some(ResultsInner {
20412041
variant: None,
20422042
connection_state: connection_state.clone(),
2043-
redirect_results: redirect_results,
2044-
answer_id: answer_id,
2045-
finish_received: finish_received,
2043+
redirect_results,
2044+
answer_id,
2045+
finish_received,
20462046
}),
20472047
results_done_fulfiller: Some(fulfiller),
20482048
}
@@ -2374,7 +2374,7 @@ impl <VatId> WeakClient<VatId> where VatId: 'static {
23742374
};
23752375
Some(Client {
23762376
connection_state: state,
2377-
variant: variant,
2377+
variant,
23782378
})
23792379
}
23802380
}
@@ -2431,7 +2431,7 @@ impl <VatId> ImportClient<VatId> where VatId: 'static {
24312431
-> Rc<RefCell<ImportClient<VatId>>> {
24322432
Rc::new(RefCell::new(ImportClient {
24332433
connection_state: connection_state.clone(),
2434-
import_id: import_id,
2434+
import_id,
24352435
remote_ref_count: 0,
24362436
}))
24372437
}
@@ -2461,8 +2461,8 @@ impl <VatId> PipelineClient<VatId> where VatId: 'static {
24612461
ops: Vec<PipelineOp>) -> Rc<RefCell<PipelineClient<VatId>>> {
24622462
Rc::new(RefCell::new(PipelineClient {
24632463
connection_state: connection_state.clone(),
2464-
question_ref: question_ref,
2465-
ops: ops,
2464+
question_ref,
2465+
ops,
24662466
}))
24672467
}
24682468
}
@@ -2501,7 +2501,7 @@ impl <VatId> PromiseClient<VatId> {
25012501
connection_state: connection_state.clone(),
25022502
is_resolved: false,
25032503
cap: initial,
2504-
import_id: import_id,
2504+
import_id,
25052505
received_call: false,
25062506
resolution_waiters: crate::sender_queue::SenderQueue::new(),
25072507
}))
@@ -2616,7 +2616,7 @@ impl <VatId> Client<VatId> {
26162616
{
26172617
let client = Client {
26182618
connection_state: connection_state.clone(),
2619-
variant: variant,
2619+
variant,
26202620
};
26212621
let weak = client.downgrade();
26222622

@@ -2641,7 +2641,7 @@ impl <VatId> Client<VatId> {
26412641
};
26422642
WeakClient {
26432643
connection_state: Rc::downgrade(&self.connection_state),
2644-
variant: variant,
2644+
variant,
26452645
}
26462646
}
26472647

@@ -2740,7 +2740,7 @@ impl <VatId> Clone for Client<VatId> {
27402740
unimplemented!()
27412741
}
27422742
};
2743-
Client { connection_state: self.connection_state.clone(), variant: variant}
2743+
Client { connection_state: self.connection_state.clone(), variant}
27442744
}
27452745
}
27462746

@@ -2893,7 +2893,7 @@ struct SingleCapPipeline {
28932893

28942894
impl SingleCapPipeline {
28952895
fn new(cap: Box<dyn ClientHook>) -> SingleCapPipeline {
2896-
SingleCapPipeline { cap: cap }
2896+
SingleCapPipeline { cap }
28972897
}
28982898
}
28992899

‎capnp-rpc/src/task_set.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<E> TaskSet<E> where E: 'static {
8787
set.in_progress.push(TaskInProgress::Task(Box::pin(::futures::future::pending())));
8888

8989
let handle = TaskSetHandle {
90-
sender: sender,
90+
sender,
9191
};
9292

9393
(handle, set)

0 commit comments

Comments
 (0)