mirror of
https://github.com/polarity-lang/polarity.git
synced 2025-08-04 18:48:13 +00:00
Address new clippy lints (#537)
This commit is contained in:
parent
421e73a38f
commit
fc6d09346d
8 changed files with 22 additions and 25 deletions
|
@ -12,7 +12,7 @@ const LATEX_END: &str = r"\end{alltt}
|
|||
fn latex_start(fontsize: &FontSize) -> String {
|
||||
let mut latex_start_string = "".to_string();
|
||||
latex_start_string.push_str("\\begin{alltt}\n");
|
||||
latex_start_string.push_str(&format!("\\{}", fontsize));
|
||||
latex_start_string.push_str(&format!("\\{fontsize}"));
|
||||
latex_start_string.push_str("\\ttfamily");
|
||||
latex_start_string
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ const BINARY: &str = "pol";
|
|||
/// Check that "pol --version" works correctly
|
||||
#[test]
|
||||
fn version_command() {
|
||||
println!("{:?}", BINARY);
|
||||
println!("{BINARY:?}");
|
||||
let mut cmd = Command::cargo_bin(BINARY).unwrap();
|
||||
let assert = cmd.arg("--version").assert();
|
||||
assert.success().stdout("polarity 0.1.0\n");
|
||||
|
|
|
@ -480,9 +480,9 @@ impl Print for Infix {
|
|||
let Infix { lhs, rhs, .. } = self;
|
||||
alloc
|
||||
.keyword(INFIX)
|
||||
.append(format!(" _ {} _ ", lhs))
|
||||
.append(format!(" _ {lhs} _ "))
|
||||
.append(COLONEQ)
|
||||
.append(format!(" {}(_,_)", rhs))
|
||||
.append(format!(" {rhs}(_,_)"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ impl VarBind {
|
|||
impl fmt::Display for VarBind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
VarBind::Var { id, .. } => write!(f, "{}", id),
|
||||
VarBind::Var { id, .. } => write!(f, "{id}"),
|
||||
VarBind::Wildcard { .. } => write!(f, "_"),
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ impl MetaVar {
|
|||
impl Print for MetaVar {
|
||||
fn print<'a>(&'a self, _cfg: &PrintCfg, alloc: &'a Alloc<'a>) -> Builder<'a> {
|
||||
let MetaVar { kind, id, span: _ } = self;
|
||||
let id = alloc.text(format!("{}", id));
|
||||
let id = alloc.text(format!("{id}"));
|
||||
match kind {
|
||||
MetaVarKind::MustSolve => alloc.text(UNDERSCORE).append(id),
|
||||
MetaVarKind::CanSolve => alloc.text(QUESTION_MARK).append(id),
|
||||
|
|
|
@ -18,9 +18,9 @@ impl Generate for Ctor {
|
|||
let doc_str = doc.generate();
|
||||
let head = format!("{}{}", name.id, parameter);
|
||||
|
||||
let head = if typ.is_simple() { head } else { format!("{}: {}", head, typs) };
|
||||
let head = if typ.is_simple() { head } else { format!("{head}: {typs}") };
|
||||
|
||||
format!("<li>{}{}</li>", doc_str, head)
|
||||
format!("<li>{doc_str}{head}</li>")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ impl Generate for Dtor {
|
|||
|
||||
let doc_str = doc.generate();
|
||||
let head =
|
||||
if self_param.is_simple() { ".".to_owned() } else { format!("{}.", self_parameter) };
|
||||
if self_param.is_simple() { ".".to_owned() } else { format!("{self_parameter}.") };
|
||||
|
||||
format!("<li>{}{}{}{}: {}</li>", doc_str, head, name.id, parmeter, ret_typ)
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ impl Generate for DocComment {
|
|||
.map(|doc| markdown_to_html(doc, &options))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n");
|
||||
format!("{}{}{}", prefix, text, postfix)
|
||||
format!("{prefix}{text}{postfix}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ impl CollectInfo for Data {
|
|||
add_doc_comment(&mut content, doc.clone().map(|doc| doc.docs));
|
||||
if !params.is_empty() {
|
||||
content.push(MarkedString::String("---".to_owned()).to_owned());
|
||||
content.push(MarkedString::String(format!("Parameters: `{}`", params)));
|
||||
content.push(MarkedString::String(format!("Parameters: `{params}`")));
|
||||
}
|
||||
let hover_content = HoverContents::Array(content);
|
||||
collector.add_hover(*span, hover_content);
|
||||
|
@ -182,11 +182,11 @@ impl CollectInfo for Codata {
|
|||
// Add hover info
|
||||
let params = typ.params.print_to_string(None);
|
||||
let mut content: Vec<MarkedString> = Vec::new();
|
||||
content.push(MarkedString::String(format!("Codata declaration: `{}`", name)));
|
||||
content.push(MarkedString::String(format!("Codata declaration: `{name}`")));
|
||||
add_doc_comment(&mut content, doc.clone().map(|doc| doc.docs));
|
||||
if !params.is_empty() {
|
||||
content.push(MarkedString::String("---".to_owned()).to_owned());
|
||||
content.push(MarkedString::String(format!("Parameters: `{}`", params)));
|
||||
content.push(MarkedString::String(format!("Parameters: `{params}`")));
|
||||
}
|
||||
let hover_content = HoverContents::Array(content);
|
||||
collector.add_hover(*span, hover_content);
|
||||
|
@ -246,7 +246,7 @@ impl CollectInfo for Ctor {
|
|||
// Add info
|
||||
let doc = doc.clone().map(|doc| doc.docs);
|
||||
let mut content: Vec<MarkedString> = Vec::new();
|
||||
content.push(MarkedString::String(format!("Constructor: `{}`", name)));
|
||||
content.push(MarkedString::String(format!("Constructor: `{name}`")));
|
||||
add_doc_comment(&mut content, doc);
|
||||
let hover_content = HoverContents::Array(content);
|
||||
collector.add_hover(*span, hover_content);
|
||||
|
@ -263,7 +263,7 @@ impl CollectInfo for Dtor {
|
|||
// Add info
|
||||
let doc = doc.clone().map(|doc| doc.docs);
|
||||
let mut content: Vec<MarkedString> = Vec::new();
|
||||
content.push(MarkedString::String(format!("Destructor: `{}`", name)));
|
||||
content.push(MarkedString::String(format!("Destructor: `{name}`")));
|
||||
add_doc_comment(&mut content, doc);
|
||||
let hover_content = HoverContents::Array(content);
|
||||
collector.add_hover(*span, hover_content);
|
||||
|
@ -355,7 +355,7 @@ impl CollectInfo for TypCtor {
|
|||
|
||||
// Add hover info
|
||||
let mut content: Vec<MarkedString> = Vec::new();
|
||||
content.push(MarkedString::String(format!("Type constructor: `{}`", name)));
|
||||
content.push(MarkedString::String(format!("Type constructor: `{name}`")));
|
||||
add_doc_comment(&mut content, doc);
|
||||
let hover_contents = HoverContents::Array(content);
|
||||
collector.add_hover(*span, hover_contents);
|
||||
|
@ -509,7 +509,7 @@ impl CollectInfo for Hole {
|
|||
let metavar_state = collector
|
||||
.meta_vars
|
||||
.get(metavar)
|
||||
.unwrap_or_else(|| panic!("Metavar {:?} not found", metavar));
|
||||
.unwrap_or_else(|| panic!("Metavar {metavar:?} not found"));
|
||||
|
||||
let metavar_str = metavar_state.solution().map(|e| {
|
||||
e.print_to_string(Some(&PrintCfg { print_metavar_ids: true, ..Default::default() }))
|
||||
|
@ -532,15 +532,14 @@ impl CollectInfo for Hole {
|
|||
let hover_contents = if let Some(ctx) = ctx {
|
||||
let mut value = String::new();
|
||||
match metavar {
|
||||
Some(mv) => value.push_str(&format!("Hole: `{}`\n\n", mv)),
|
||||
Some(mv) => value.push_str(&format!("Hole: `{mv}`\n\n")),
|
||||
None => value.push_str("Hole: `?`\n\n"),
|
||||
}
|
||||
goal_to_markdown(&goal, &mut value);
|
||||
value.push_str("\n\n");
|
||||
ctx_to_markdown(&ctx, &mut value);
|
||||
value.push_str("\n\nArguments:\n\n");
|
||||
let args_str =
|
||||
args.iter().cloned().map(comma_separated).map(|s| format!("({})", s));
|
||||
let args_str = args.iter().cloned().map(comma_separated).map(|s| format!("({s})"));
|
||||
let args_str = format!("({})", comma_separated(args_str));
|
||||
value.push_str(&args_str);
|
||||
if let Some(solution) = metavar_str {
|
||||
|
|
|
@ -11,7 +11,7 @@ pub enum LexicalError {
|
|||
|
||||
impl fmt::Display for LexicalError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
write!(f, "{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ pub enum Token {
|
|||
|
||||
impl fmt::Display for Token {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
write!(f, "{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,7 @@ impl FileSource for FetchSource {
|
|||
}
|
||||
|
||||
async fn write_string(&mut self, uri: &reqwest::Url, _source: &str) -> Result<(), DriverError> {
|
||||
web_sys::console::warn_1(
|
||||
&format!("Attempted to write to read-only source: {}", uri).into(),
|
||||
);
|
||||
web_sys::console::warn_1(&format!("Attempted to write to read-only source: {uri}").into());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue