Skip to content

Commit 86fee7a

Browse files
committed
Update clippy suggestions
1 parent 93b7052 commit 86fee7a

File tree

10 files changed

+23
-24
lines changed

10 files changed

+23
-24
lines changed

vhdl_lang/src/analysis/declarative.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,8 +1349,8 @@ fn pretty_format_unassociated_message(unassociated: &HashSet<&RecordElement<'_>>
13491349
desc
13501350
};
13511351
if unassociated.len() == 1 {
1352-
format!("Missing association of element {}", description)
1352+
format!("Missing association of element {description}")
13531353
} else {
1354-
format!("Missing association of elements {}", description)
1354+
format!("Missing association of elements {description}")
13551355
}
13561356
}

vhdl_lang/src/analysis/overloaded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl<'a> AnalyzeContext<'a, '_> {
312312
} else if ok_kind.is_empty() {
313313
diagnostics.add(
314314
call_name.pos(self.ctx),
315-
format!("uninstantiated subprogram {} cannot be called", call_name),
315+
format!("uninstantiated subprogram {call_name} cannot be called"),
316316
ErrorCode::InvalidCall,
317317
);
318318
return Err(EvalError::Unknown);

vhdl_lang/src/ast/display.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl Display for Designator {
628628
Designator::Identifier(ref sym) => write!(f, "{sym}"),
629629
Designator::OperatorSymbol(ref op) => write!(f, "\"{op}\""),
630630
Designator::Character(byte) => write!(f, "'{}'", iso_8859_1_to_utf8(&[*byte])),
631-
Designator::Anonymous(idx) => write!(f, "<anonymous {}>", idx),
631+
Designator::Anonymous(idx) => write!(f, "<anonymous {idx}>"),
632632
}
633633
}
634634
}
@@ -765,7 +765,7 @@ impl Display for ObjectDeclaration {
765765
self.class,
766766
self.idents
767767
.iter()
768-
.map(|ident| format!("{}", ident))
768+
.map(|ident| format!("{ident}"))
769769
.join(", "),
770770
self.subtype_indication,
771771
)?;
@@ -916,7 +916,7 @@ impl Display for SubprogramInstantiation {
916916
write!(f, " is new ")?;
917917
write!(f, "{}", self.subprogram_name)?;
918918
if let Some(signature) = &self.signature {
919-
write!(f, " {}", signature)?;
919+
write!(f, " {signature}")?;
920920
}
921921
if let Some(generic_map) = &self.generic_map {
922922
writeln!(f, " generic map (")?;

vhdl_lang/src/completion/entity_instantiation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ end arch;
277277
_ => None,
278278
})
279279
.collect_vec();
280-
println!("{:?}", applicable_options);
280+
println!("{applicable_options:?}");
281281
match &applicable_options[..] {
282282
[(got_ent, architectures)] => {
283283
pretty_assertions::assert_eq!(*got_ent, ent);

vhdl_lang/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ impl Config {
7878
for (name, lib) in libs.iter() {
7979
if name.to_lowercase() == "work" {
8080
return Err(format!(
81-
"The '{}' library is not a valid library.\nHint: To use a library that contains all files, use a common name for all libraries, i.e., 'defaultlib'",
82-
name
81+
"The '{name}' library is not a valid library.\nHint: To use a library that contains all files, use a common name for all libraries, i.e., 'defaultlib'"
8382
));
8483
}
8584

vhdl_lang/src/named_entity/formal_region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl<'a> FormalRegion<'a> {
190190
if let Some(ent) = InterfaceEnt::from_any(param) {
191191
self.entities.push(ent);
192192
} else {
193-
println!("kind: {:?}", param);
193+
println!("kind: {param:?}");
194194
debug_assert!(false);
195195
}
196196
}

vhdl_lang/src/syntax/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ pub fn check_diagnostics(got: Vec<Diagnostic>, expected: Vec<Diagnostic>) {
873873
println!("Got right diagnostic but wrong count {got_count}, expected {count}");
874874
println!("-------------------------------------------------------");
875875
print!("{}: ", diagnostic.code);
876-
println!("{:?}", diagnostic);
876+
println!("{diagnostic:?}");
877877
}
878878
}
879879
None => {
@@ -882,7 +882,7 @@ pub fn check_diagnostics(got: Vec<Diagnostic>, expected: Vec<Diagnostic>) {
882882
println!("Got no diagnostic, expected {count}");
883883
println!("-------------------------------------------------------");
884884
print!("{}: ", diagnostic.code);
885-
println!("{:?}", diagnostic);
885+
println!("{diagnostic:?}");
886886
}
887887
}
888888
}
@@ -893,7 +893,7 @@ pub fn check_diagnostics(got: Vec<Diagnostic>, expected: Vec<Diagnostic>) {
893893
println!("Got unexpected diagnostic");
894894
println!("-------------------------------------------------------");
895895
print!("{}: ", diagnostic.code);
896-
println!("{:?}", diagnostic);
896+
println!("{diagnostic:?}");
897897
}
898898

899899
if found_errors {

vhdl_lang/src/syntax/tokens/tokenizer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ impl Display for TokenSpan {
563563

564564
impl Debug for TokenSpan {
565565
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
566-
write!(f, "{}", self)
566+
write!(f, "{self}")
567567
}
568568
}
569569

@@ -2732,7 +2732,7 @@ my_other_ident",
27322732
// May not use digit larger than or equal base
27332733
let code = Code::new("3#3#");
27342734
let (tokens, _) = code.tokenize_result();
2735-
println!("{:?}", tokens);
2735+
println!("{tokens:?}");
27362736
assert_eq!(
27372737
tokens,
27382738
vec![Err(Diagnostic::syntax_error(

vhdl_ls/src/stdio_server.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl RpcChannel for ConnectionRpcChannel {
4343
fn send_notification(&self, method: String, params: Value) {
4444
let notification = lsp_server::Notification { method, params };
4545

46-
trace!("Sending notification: {:?}", notification);
46+
trace!("Sending notification: {notification:?}");
4747
self.connection.sender.send(notification.into()).unwrap();
4848
}
4949

@@ -84,7 +84,7 @@ impl ConnectionRpcChannel {
8484
fn main_event_loop(&self, mut server: VHDLServer) {
8585
info!("Language server initialized, waiting for messages ...");
8686
while let Ok(message) = self.connection.receiver.recv() {
87-
trace!("Received message: {:?}", message);
87+
trace!("Received message: {message:?}");
8888
match message {
8989
lsp_server::Message::Request(request) => {
9090
match self.connection.handle_shutdown(&request) {
@@ -110,7 +110,7 @@ impl ConnectionRpcChannel {
110110

111111
/// Send responses (to requests sent by the client) back to the client.
112112
fn send_response(&self, response: lsp_server::Response) {
113-
trace!("Sending response: {:?}", response);
113+
trace!("Sending response: {response:?}");
114114
self.connection.sender.send(response.into()).unwrap();
115115
}
116116

@@ -131,7 +131,7 @@ impl ConnectionRpcChannel {
131131
})
132132
}
133133

134-
trace!("Handling request: {:?}", request);
134+
trace!("Handling request: {request:?}");
135135
let request = match extract::<request::GotoDeclaration>(request) {
136136
Ok((id, params)) => {
137137
let result =
@@ -231,7 +231,7 @@ impl ConnectionRpcChannel {
231231
Err(request) => request,
232232
};
233233

234-
debug!("Unhandled request: {:?}", request);
234+
debug!("Unhandled request: {request:?}");
235235
self.send_response(lsp_server::Response::new_err(
236236
request.id,
237237
lsp_server::ErrorCode::MethodNotFound as i32,
@@ -256,7 +256,7 @@ impl ConnectionRpcChannel {
256256
})
257257
}
258258

259-
trace!("Handling notification: {:?}", notification);
259+
trace!("Handling notification: {notification:?}");
260260
// textDocument/didChange
261261
let notification = match extract::<notification::DidChangeTextDocument>(notification) {
262262
Ok(params) => return server.text_document_did_change_notification(&params),
@@ -279,13 +279,13 @@ impl ConnectionRpcChannel {
279279
};
280280

281281
if !notification.method.starts_with("$/") {
282-
debug!("Unhandled notification: {:?}", notification);
282+
debug!("Unhandled notification: {notification:?}");
283283
}
284284
}
285285

286286
/// Handle incoming responses (to requests sent by us) from the client.
287287
fn handle_response(&self, _server: &mut VHDLServer, response: lsp_server::Response) {
288-
trace!("Handling response: {:?}", response);
288+
trace!("Handling response: {response:?}");
289289
// We currently can ignore incoming responses as the implemented
290290
// outgoing requests do not require confirmation by the client.
291291
}

vhdl_ls/src/vhdl_server/completion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl VHDLServer {
8484
let (ports, generics) = region.ports_and_generics();
8585
let mut idx = 4;
8686
let mut interface_ent = |elements: Vec<InterfaceEnt>, purpose: &str| {
87-
line += &*format!("\n {} map(\n", purpose);
87+
line += &*format!("\n {purpose} map(\n");
8888
for (i, generic) in elements.iter().enumerate() {
8989
line += &*format!(
9090
" {} => ${{{}:{}}}",

0 commit comments

Comments
 (0)