repo string | pull_number int64 | instance_id string | issue_numbers list | base_commit string | patch string | test_patch string | problem_statement string | hints_text string | created_at string | version string | updated_at string | environment_setup_commit string | FAIL_TO_PASS list | PASS_TO_PASS list | FAIL_TO_FAIL list | PASS_TO_FAIL list | source_dir string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rinja-rs/askama | 788 | rinja-rs__askama-788 | [
"786"
] | 417cb924ae1f94d54e2eb13ebc7e9fab91b84588 | diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -630,16 +630,16 @@ impl<'a> Generator<'a> {
self.write_let(buf, ws, var, val)?;
}
Node::Cond(ref conds, ws) => {
- self.write_cond(ctx, buf, conds, ws)?;
+ size_hint += self.write_cond(ctx, buf, conds, ws)?;
}
Node::Match(ws1, ref expr, ref arms, ws2) => {
- self.write_match(ctx, buf, ws1, expr, arms, ws2)?;
+ size_hint += self.write_match(ctx, buf, ws1, expr, arms, ws2)?;
}
Node::Loop(ref loop_block) => {
- self.write_loop(ctx, buf, loop_block)?;
+ size_hint += self.write_loop(ctx, buf, loop_block)?;
}
Node::BlockDef(ws1, name, _, ws2) => {
- self.write_block(buf, Some(name), Ws(ws1.0, ws2.1))?;
+ size_hint += self.write_block(buf, Some(name), Ws(ws1.0, ws2.1))?;
}
Node::Include(ws, path) => {
size_hint += self.handle_include(ctx, buf, ws, path)?;
| diff --git /dev/null b/testing/templates/size-child-super.txt
new file mode 100644
--- /dev/null
+++ b/testing/templates/size-child-super.txt
@@ -0,0 +1,2 @@
+{% extends "size-parent.txt" %}
+{% block main %}{% call super() %}{% endblock %}
diff --git /dev/null b/testing/templates/size-child.txt
new file mode 100644
--- /dev/null
+++ b/testing/templates/size-child.txt
@@ -0,0 +1,2 @@
+{% extends "size-parent.txt" %}
+{% block main %}{% if true %}123{% endif %}{% endblock %}
diff --git /dev/null b/testing/templates/size-parent.txt
new file mode 100644
--- /dev/null
+++ b/testing/templates/size-parent.txt
@@ -0,0 +1,1 @@
+{% block main %}{% if true %}12345{% endif %}{% endblock %}
diff --git /dev/null b/testing/tests/size_hint.rs
new file mode 100644
--- /dev/null
+++ b/testing/tests/size_hint.rs
@@ -0,0 +1,47 @@
+use askama::Template;
+
+macro_rules! test_size {
+ ($source:literal, $expected:expr) => {{
+ #[derive(Template)]
+ #[template(source = $source, ext = "txt")]
+ struct T(bool);
+
+ assert_eq!(T::SIZE_HINT, $expected);
+ }};
+}
+
+#[test]
+fn test_cond_size_hint() {
+ test_size!("{% if self.0 %}12345{% else %}12345{% endif %}", 10);
+}
+
+#[test]
+fn test_match_size_hint() {
+ test_size!(
+ "{% match self.0 %}{% when true %}12345{% else %}12345{% endmatch %}",
+ 5
+ );
+}
+
+#[test]
+fn test_loop_size_hint() {
+ test_size!("{% for i in 0..1 %}12345{% endfor %}", 7);
+}
+
+#[test]
+fn test_block_size_hint() {
+ #[derive(Template)]
+ #[template(path = "size-child.txt")]
+ struct T;
+
+ assert_eq!(T::SIZE_HINT, 3);
+}
+
+#[test]
+fn test_super_size_hint() {
+ #[derive(Template)]
+ #[template(path = "size-child-super.txt")]
+ struct T;
+
+ assert_eq!(T::SIZE_HINT, 5);
+}
| Is write_cond trying to return a size_hint?
It looks like `write_cond` is accumulating a contribution to `size_hint`:
https://github.com/djc/askama/blob/417cb924ae1f94d54e2eb13ebc7e9fab91b84588/askama_derive/src/generator.rs#L760
But it seems to be dropped on the floor:
https://github.com/djc/askama/blob/417cb924ae1f94d54e2eb13ebc7e9fab91b84588/askama_derive/src/generator.rs#L633
Should this instead be `size_hint += self.write_cond(ctx, buf, conds, ws)?;`?
| Same question for `write_match`, `write_loop`, `write_block`, maybe others? I'm starting to think there's more to accumulating the `size_hint` than it looks like at first glance? | 2023-03-06T20:45:26Z | 0.12 | 2023-03-07T09:53:22Z | 4dab5f91ba15e7c238ddf6223ec7b45eef32cab4 | [
"test_block_size_hint",
"test_loop_size_hint",
"test_cond_size_hint",
"test_match_size_hint",
"test_super_size_hint"
] | [] | [] | [] | auto_2025-06-03 |
rinja-rs/askama | 436 | rinja-rs__askama-436 | [
"435"
] | 000aff4a18c90a5074afd1af5587ff94e915e7d1 | diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -88,7 +93,7 @@ where
escaper: E,
}
-impl<'a, E> ::std::fmt::Display for Escaped<'a, E>
+impl<'a, E> Display for Escaped<'a, E>
where
E: Escaper,
{
| diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -1,5 +1,10 @@
-use std::fmt::{self, Display, Formatter, Write};
-use std::str;
+#![no_std]
+
+#[cfg(test)]
+extern crate std;
+
+use core::fmt::{self, Display, Formatter, Write};
+use core::str;
pub struct MarkupDisplay<E, T>
where
diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -168,6 +173,8 @@ const FLAG: u8 = b'>' - b'"';
#[cfg(test)]
mod tests {
use super::*;
+ use std::string::ToString;
+
#[test]
fn test_escape() {
assert_eq!(escape("", Html).to_string(), "");
| no-std support for askama_escape
Just taking a glance through the code, nothing that required `std` popped out to me, if you're happy to make this crate no-std compatible I can prepare a PR for it?
| 2021-01-15T22:04:25Z | 0.10 | 2021-01-15T22:35:34Z | 49252d2457f280026c020d0df46733578eb959a5 | [
"tests::test_escape"
] | [] | [] | [] | auto_2025-06-03 | |
rinja-rs/askama | 1,027 | rinja-rs__askama-1027 | [
"1026"
] | 8d3a3f73d4b06c4bfe7417bb4cee3b6c49c1a5fc | "diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs\n--- a/askama_parser/src/node.rs(...TRUNCATED) | "diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs\n--- a/askama_parser/src/tests(...TRUNCATED) | "Nested comments causes parser to timeout\nHi,\r\n\r\nLarge nested comments like below(produced by f(...TRUNCATED) | 2024-04-30T21:00:38Z | 0.13 | 2024-05-01T11:55:08Z | 53b4b518f9a230665029560df038c318b2e55458 | [
"tests::fuzzed_comment_depth"
] | ["test::test_num_lit","test::test_char_lit","tests::change_delimiters_parse_filter","tests::fuzzed_m(...TRUNCATED) | [
"test::test_strip_common"
] | [] | auto_2025-06-03 | |
axodotdev/cargo-dist | 1,135 | axodotdev__cargo-dist-1135 | [
"36"
] | ff3d2ba9b0f0a25bb64dbf8d31e865fb32b9a2f1 | "diff --git a/Cargo.lock b/Cargo.lock\n--- a/Cargo.lock\n+++ b/Cargo.lock\n@@ -126,24 +126,6 @@ vers(...TRUNCATED) | "diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml\n--- a/.github/workflows/ci.yml\n+(...TRUNCATED) | "handle colliding targets properly\nUnder the current design, we:\r\n\r\n1. Compute everything that (...TRUNCATED) | "Also note that this bug can't be witnessed right now because we have no way to pass in build settin(...TRUNCATED) | 2024-06-17T16:55:16Z | 4.5 | 2024-06-17T18:58:14Z | ff3d2ba9b0f0a25bb64dbf8d31e865fb32b9a2f1 | ["backend::installer::homebrew::tests::class_caps_after_numbers","backend::installer::homebrew::test(...TRUNCATED) | [] | [] | [] | auto_2025-06-11 |
biomejs/biome | 585 | biomejs__biome-585 | [
"44"
] | 8287c1a37bc7024ce4f9c88f32d7dd96678c51aa | "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -96,6 +96,13 @(...TRUNCATED) | "diff --git /dev/null b/crates/biome_js_analyze/src/analyzers/nursery/no_unused_private_class_member(...TRUNCATED) | "📎 Implement `lint/noUnusedPrivateClassMembers` - `eslint/no-unused-private-class-members`\n### D(...TRUNCATED) | "@Conaclos I'll work on this one.\r\n\r\nThis rule should also cover private members in typescript ?(...TRUNCATED) | 2023-10-23T02:41:54Z | 0.2 | 2023-12-06T21:53:41Z | cf9a586d69b09437bf4b7f075df0aa627daa891d | ["specs::nursery::no_unused_private_class_members::valid_js","specs::nursery::no_unused_private_clas(...TRUNCATED) | ["analyzers::correctness::no_nonoctal_decimal_escape::tests::test_is_octal_escape_sequence","analyze(...TRUNCATED) | [] | [] | auto_2025-06-09 |
biomejs/biome | 4,791 | biomejs__biome-4791 | [
"3969"
] | 3c32a66294c817d733c9f65c1916328a42c5efa9 | "diff --git a/Cargo.toml b/Cargo.toml\n--- a/Cargo.toml\n+++ b/Cargo.toml\n@@ -13,6 +13,7 @@ unused_(...TRUNCATED) | "diff --git a/crates/biome_cli/tests/commands/format.rs b/crates/biome_cli/tests/commands/format.rs\(...TRUNCATED) | "📎 Replace Clippy `allow` with `expect`\n### Description\r\n\r\nRust 1.81 stabilizes Clippy's [`(...TRUNCATED) | "I just noticed you don't use 1.81.0 yet, so this task needs to wait until to move to 1.81\n> so thi(...TRUNCATED) | 2024-12-24T19:28:20Z | 0.5 | 2024-12-29T16:48:49Z | 2425ce767fc6a93bbd091a5a9ec18beb5476e204 | [
"err::multidigit_number_then_00_json",
"err::structure_null_byte_outside_string_json"
] | ["commands::tests::incompatible_arguments","commands::tests::no_fix","diagnostics::test::termination(...TRUNCATED) | [
"commands::explain::explain_help"
] | [
"cases::diagnostics::max_diagnostics_are_lifted",
"commands::lsp_proxy::lsp_proxy_help"
] | auto_2025-06-09 |
boa-dev/boa | 629 | boa-dev__boa-629 | [
"610"
] | ad162e09e39818862c10bcfc08bc788c44a85d5d | "diff --git a/boa/src/builtins/string/mod.rs b/boa/src/builtins/string/mod.rs\n--- a/boa/src/builtin(...TRUNCATED) | "diff --git a/boa/src/builtins/string/tests.rs b/boa/src/builtins/string/tests.rs\n--- a/boa/src/bui(...TRUNCATED) | "Error in RegExp\nHi,\r\n\r\nThe following code snippet works incorrectly for RegExp\r\n\r\n```js\r\(...TRUNCATED) | "Hmmm. This this is probably a bug in `String.prototype.replace`.\nI think I've found the mistake an(...TRUNCATED) | 2020-08-13T21:49:23Z | 0.9 | 2020-09-01T16:41:49Z | 8816df8f434e3ae4ba6f56fb7c49211ec370b916 | [
"builtins::bigint::tests::r#mod"
] | ["builtins::date::tests::date_display","src/builtins/bigint/operations.rs - builtins::bigint::operat(...TRUNCATED) | [] | [] | auto_2025-06-09 |
bevyengine/bevy | 15,281 | bevyengine__bevy-15281 | [
"6370",
"6581"
] | 0fe33c3bbaf58ce89d85e97092fc45438d2da4ff | "diff --git a/Cargo.toml b/Cargo.toml\n--- a/Cargo.toml\n+++ b/Cargo.toml\n@@ -48,6 +48,10 @@ ref_as(...TRUNCATED) | "diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs\n--- a/crates/bevy_app/src/app(...TRUNCATED) | "Prefer `core` and `alloc` over `std` where possible\n## What problem does this solve or what need d(...TRUNCATED) | "I would add a O-Console label here, but we don't have one yet :P\nReal fast attempt applying this j(...TRUNCATED) | 2024-09-18T05:48:37Z | 1.81 | 2024-10-20T14:34:22Z | 60b2c7ce7755a49381c5265021ff175d3624218c | ["app::tests::can_add_two_plugins","plugin_group::tests::readd","plugin_group::tests::add_basic_subg(...TRUNCATED) | ["bounding::bounded2d::aabb2d_tests::area","bounding::bounded2d::aabb2d_tests::closest_point","bound(...TRUNCATED) | [] | [] | auto_2025-06-08 |
dtolnay/async-trait | 260 | dtolnay__async-trait-260 | [
"259"
] | 62969d525fbd76abec15edf00289ced049b7fa0a | "diff --git a/src/expand.rs b/src/expand.rs\n--- a/src/expand.rs\n+++ b/src/expand.rs\n@@ -125,6 +12(...TRUNCATED) | "diff --git a/tests/test.rs b/tests/test.rs\n--- a/tests/test.rs\n+++ b/tests/test.rs\n@@ -2,7 +2,7 (...TRUNCATED) | "Using async-trait with nightly-2024-03-04 triggers `unused-qualifications` lint\nConsider the follo(...TRUNCATED) | 2024-03-16T23:27:55Z | 0.1 | 2024-03-16T23:37:31Z | f8e5bb43181450a17068f160e8a51d410ede1705 | ["drop_order::test_drop_order","issue57::test","issue45::tracing","issue199::test","src/lib.rs - (li(...TRUNCATED) | [] | [] | [] | auto_2025-06-06 | |
dtolnay/async-trait | 239 | dtolnay__async-trait-239 | [
"238"
] | 7937a8900b6546dc1c9b2e931647d3d21c854cd0 | "diff --git a/src/expand.rs b/src/expand.rs\n--- a/src/expand.rs\n+++ b/src/expand.rs\n@@ -80,13 +80(...TRUNCATED) | "diff --git a/tests/test.rs b/tests/test.rs\n--- a/tests/test.rs\n+++ b/tests/test.rs\n@@ -1585,3 +1(...TRUNCATED) | "Weird interaction with `single_use_lifetimes`\n[playground](https://play.rust-lang.org/?version=sta(...TRUNCATED) | 2023-03-04T06:54:09Z | 0.1 | 2023-03-04T06:56:03Z | f8e5bb43181450a17068f160e8a51d410ede1705 | ["drop_order::test_drop_order","issue199::test","issue45::tracing","src/lib.rs - (line 15) - compile(...TRUNCATED) | [] | [] | [] | auto_2025-06-06 |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 70